mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 22:09:08 +08:00
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:
@@ -5,6 +5,7 @@ import {
|
||||
buildShowcaseWorkspace,
|
||||
createFirstAppData,
|
||||
} from '@affine/core/utils/first-app-data';
|
||||
import { ServerFeature } from '@affine/graphql';
|
||||
import {
|
||||
useLiveData,
|
||||
useService,
|
||||
@@ -52,10 +53,12 @@ export const Component = ({
|
||||
const loggedIn = useLiveData(
|
||||
authService.session.status$.map(s => s === 'authenticated')
|
||||
);
|
||||
const allowGuestDemo =
|
||||
const enableLocalWorkspace =
|
||||
useLiveData(
|
||||
defaultServerService.server.config$.selector(
|
||||
c => c.allowGuestDemoWorkspace
|
||||
c =>
|
||||
c.features.includes(ServerFeature.LocalWorkspace) ||
|
||||
BUILD_CONFIG.isNative
|
||||
)
|
||||
) ?? true;
|
||||
|
||||
@@ -92,7 +95,7 @@ export const Component = ({
|
||||
return;
|
||||
}
|
||||
|
||||
if (!allowGuestDemo && !loggedIn) {
|
||||
if (!enableLocalWorkspace && !loggedIn) {
|
||||
localStorage.removeItem('last_workspace_id');
|
||||
jumpToSignIn();
|
||||
return;
|
||||
@@ -125,7 +128,7 @@ export const Component = ({
|
||||
openPage(openWorkspace.id, defaultIndexRoute, RouteLogic.REPLACE);
|
||||
}
|
||||
}, [
|
||||
allowGuestDemo,
|
||||
enableLocalWorkspace,
|
||||
createCloudWorkspace,
|
||||
list,
|
||||
openPage,
|
||||
|
||||
Reference in New Issue
Block a user