fix(server): use new LocalWorkspace ServerFeature instead (#13091)

keep compatibility

close AF-2720



#### PR Dependency Tree


* **PR #13091** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

* **New Features**
* Added a new `LocalWorkspace` feature flag to server configuration,
enabling more flexible feature management.

* **Deprecations**
* The `allowGuestDemoWorkspace` flag is now deprecated and will be
removed in version 0.25.0. Please use the `features` array for feature
checks instead.

* **Bug Fixes**
* Updated UI and logic throughout the app to rely on the new
`LocalWorkspace` feature flag rather than the deprecated boolean flag.

* **Chores**
* Removed references to `allowGuestDemoWorkspace` from configuration,
queries, and type definitions for improved consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #13091** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
fengmk2
2025-07-08 23:23:42 +08:00
committed by GitHub
parent 15db657b1c
commit 95f88c378c
18 changed files with 79 additions and 37 deletions
@@ -17,7 +17,7 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
// since we never build desktop app in selfhosted mode, so it's fine
config: {
serverName: 'Affine Selfhost',
features: [],
features: [ServerFeature.LocalWorkspace],
oauthProviders: [],
type: ServerDeploymentType.Selfhosted,
credentialsRequirement: {
@@ -26,7 +26,6 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
maxLength: 32,
},
},
allowGuestDemoWorkspace: true,
},
},
]
@@ -45,6 +44,7 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
ServerFeature.CopilotEmbedding,
ServerFeature.OAuth,
ServerFeature.Payment,
ServerFeature.LocalWorkspace,
],
oauthProviders: [
OAuthProviderType.Google,
@@ -57,7 +57,6 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
maxLength: 32,
},
},
allowGuestDemoWorkspace: true,
},
},
]
@@ -78,6 +77,7 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
ServerFeature.CopilotEmbedding,
ServerFeature.OAuth,
ServerFeature.Payment,
ServerFeature.LocalWorkspace,
],
oauthProviders: [
OAuthProviderType.Google,
@@ -90,7 +90,6 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
maxLength: 32,
},
},
allowGuestDemoWorkspace: true,
},
},
]
@@ -111,6 +110,7 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
ServerFeature.CopilotEmbedding,
ServerFeature.OAuth,
ServerFeature.Payment,
ServerFeature.LocalWorkspace,
],
oauthProviders: [
OAuthProviderType.Google,
@@ -123,7 +123,6 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
maxLength: 32,
},
},
allowGuestDemoWorkspace: true,
},
},
]
@@ -140,6 +139,7 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
ServerFeature.CopilotEmbedding,
ServerFeature.OAuth,
ServerFeature.Payment,
ServerFeature.LocalWorkspace,
],
oauthProviders: [
OAuthProviderType.Google,
@@ -152,7 +152,6 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
maxLength: 32,
},
},
allowGuestDemoWorkspace: true,
},
},
]
@@ -171,6 +170,7 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
ServerFeature.CopilotEmbedding,
ServerFeature.OAuth,
ServerFeature.Payment,
ServerFeature.LocalWorkspace,
],
oauthProviders: [
OAuthProviderType.Google,
@@ -183,7 +183,6 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
maxLength: 32,
},
},
allowGuestDemoWorkspace: true,
},
},
]
@@ -82,7 +82,6 @@ export class Server extends Entity<{
credentialsRequirement: config.credentialsRequirement,
features: config.features,
oauthProviders: config.oauthProviders,
allowGuestDemoWorkspace: config.allowGuestDemoWorkspace,
serverName: config.name,
type: config.type,
version: config.version,
@@ -82,7 +82,6 @@ export class ServersService extends Service {
credentialsRequirement: config.credentialsRequirement,
features: config.features,
oauthProviders: config.oauthProviders,
allowGuestDemoWorkspace: config.allowGuestDemoWorkspace,
serverName: config.name,
type: config.type,
initialized: config.initialized,
@@ -14,7 +14,6 @@ export interface ServerMetadata {
export interface ServerConfig {
serverName: string;
features: ServerFeature[];
allowGuestDemoWorkspace: boolean;
oauthProviders: OAuthProviderType[];
type: ServerDeploymentType;
initialized?: boolean;