Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: 0.7.3 improvements (#6731)
Mathias Mogensen0a1af4e61fde
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_menu_items.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_menu_items.dartindex 52c643168c..217245e75f 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_menu_items.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_menu_items.dart@@ -640,6 +640,7 @@ SelectionMenuItem subPageSlashMenuItem = SelectionMenuItem.node(LocaleKeys.document_slashMenu_subPage_keyword5.tr(),LocaleKeys.document_slashMenu_subPage_keyword6.tr(),LocaleKeys.document_slashMenu_subPage_keyword7.tr(),+ LocaleKeys.document_slashMenu_subPage_keyword8.tr(),],updateSelection: (_, path, __, ___) =>Selection.collapsed(Position(path: path)),diff --git a/frontend/appflowy_flutter/lib/workspace/application/sidebar/billing/sidebar_plan_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/sidebar/billing/sidebar_plan_bloc.dartindex 64aa425117..6b3c6c29ee 100644--- a/frontend/appflowy_flutter/lib/workspace/application/sidebar/billing/sidebar_plan_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/sidebar/billing/sidebar_plan_bloc.dart@@ -167,6 +167,10 @@ class SidebarPlanBloc extends Bloc<SidebarPlanEvent, SidebarPlanState> {),);},+ changedWorkspace: (workspaceId) {+ emit(state.copyWith(workspaceId: workspaceId));+ _checkWorkspaceUsage();+ },);}@@ -200,6 +204,10 @@ class SidebarPlanEvent with _$SidebarPlanEvent {SidebarToastTierIndicator indicator,) = _UpdateTierIndicator;const factory SidebarPlanEvent.receiveError(FlowyError error) = _ReceiveError;++ const factory SidebarPlanEvent.changedWorkspace({+ required String workspaceId,+ }) = _ChangedWorkspace;}@freezed@@ -216,7 +224,6 @@ class SidebarPlanState with _$SidebarPlanState {@freezedclass SidebarToastTierIndicator with _$SidebarToastTierIndicator {- // when start downloading the modelconst factory SidebarToastTierIndicator.storageLimitHit() = _StorageLimitHit;const factory SidebarToastTierIndicator.aiMaxiLimitHit() = _aiMaxLimitHit;const factory SidebarToastTierIndicator.loading() = _Loading;diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dartindex bd173b022d..1a396b26dd 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart@@ -75,131 +75,140 @@ class HomeSideBar extends StatelessWidget {// +-- Public Or Private Section: control the sections of the workspace// |// +-- Trash Section- return BlocConsumer<UserWorkspaceBloc, UserWorkspaceState>(- listenWhen: (previous, current) =>- previous.currentWorkspace?.workspaceId !=- current.currentWorkspace?.workspaceId,- listener: (context, state) {- if (FeatureFlag.search.isOn) {- // Notify command palette that workspace has changed- context.read<CommandPaletteBloc>().add(- CommandPaletteEvent.workspaceChanged(- workspaceId: state.currentWorkspace?.workspaceId,- ),- );- }-- // Re-initialize workspace-specific services- getIt<CachedRecentService>().reset();- },- // Rebuild the whole sidebar when the current workspace changes- buildWhen: (previous, current) =>- previous.currentWorkspace?.workspaceId !=- current.currentWorkspace?.workspaceId,- builder: (context, state) {- if (state.currentWorkspace == null) {- return const SizedBox.shrink();- }+ return BlocProvider(+ create: (context) => SidebarPlanBloc()+ ..add(SidebarPlanEvent.init(workspaceSetting.workspaceId, userProfile)),+ child: BlocConsumer<UserWorkspaceBloc, UserWorkspaceState>(+ listenWhen: (prev, curr) =>+ prev.currentWorkspace?.workspaceId !=+ curr.currentWorkspace?.workspaceId,+ listener: (context, state) {+ if (FeatureFlag.search.isOn) {+ // Notify command palette that workspace has changed+ context.read<CommandPaletteBloc>().add(+ CommandPaletteEvent.workspaceChanged(+ workspaceId: state.currentWorkspace?.workspaceId,+ ),+ );+ }- final workspaceId =- state.currentWorkspace?.workspaceId ?? workspaceSetting.workspaceId;- return MultiBlocProvider(- providers: [- BlocProvider.value(value: getIt<ActionNavigationBloc>()),- BlocProvider(- create: (_) => SidebarSectionsBloc()- ..add(SidebarSectionsEvent.initial(userProfile, workspaceId)),- ),- BlocProvider(- create: (_) =>- SpaceBloc(userProfile: userProfile, workspaceId: workspaceId)- ..add(const SpaceEvent.initial(openFirstPage: false)),- ),- BlocProvider(- create: (_) => SidebarPlanBloc()- ..add(SidebarPlanEvent.init(workspaceId, userProfile)),- ),- ],- child: MultiBlocListener(- listeners: [- BlocListener<SidebarSectionsBloc, SidebarSectionsState>(- listenWhen: (p, c) =>- p.lastCreatedRootView?.id != c.lastCreatedRootView?.id,- listener: (context, state) => context.read<TabsBloc>().add(- TabsEvent.openPlugin(- plugin: state.lastCreatedRootView!.plugin(),- ),- ),- ),- BlocListener<SpaceBloc, SpaceState>(- listenWhen: (p, c) =>- p.lastCreatedPage?.id != c.lastCreatedPage?.id ||- p.isDuplicatingSpace != c.isDuplicatingSpace,- listener: (context, state) {- final page = state.lastCreatedPage;- if (page == null || page.id.isEmpty) {- // open the blank page- context- .read<TabsBloc>()- .add(TabsEvent.openPlugin(plugin: BlankPagePlugin()));- } else {- context.read<TabsBloc>().add(- TabsEvent.openPlugin(- plugin: state.lastCreatedPage!.plugin(),- ),- );- }-- if (state.isDuplicatingSpace) {- _duplicateSpaceLoading ??= Loading(context);- _duplicateSpaceLoading?.start();- } else if (_duplicateSpaceLoading != null) {- _duplicateSpaceLoading?.stop();- _duplicateSpaceLoading = null;- }- },+ if (state.currentWorkspace != null) {+ context.read<SidebarPlanBloc>().add(+ SidebarPlanEvent.changedWorkspace(+ workspaceId: state.currentWorkspace!.workspaceId,+ ),+ );+ }++ // Re-initialize workspace-specific services+ getIt<CachedRecentService>().reset();+ },+ // Rebuild the whole sidebar when the current workspace changes+ buildWhen: (previous, current) =>+ previous.currentWorkspace?.workspaceId !=+ current.currentWorkspace?.workspaceId,+ builder: (context, state) {+ if (state.currentWorkspace == null) {+ return const SizedBox.shrink();+ }++ final workspaceId = state.currentWorkspace?.workspaceId ??+ workspaceSetting.workspaceId;+ return MultiBlocProvider(+ providers: [+ BlocProvider.value(value: getIt<ActionNavigationBloc>()),+ BlocProvider(+ create: (_) => SidebarSectionsBloc()+ ..add(SidebarSectionsEvent.initial(userProfile, workspaceId)),),- BlocListener<ActionNavigationBloc, ActionNavigationState>(- listenWhen: (_, curr) => curr.action != null,- listener: _onNotificationAction,+ BlocProvider(+ create: (_) => SpaceBloc(+ userProfile: userProfile,+ workspaceId: workspaceId,+ )..add(const SpaceEvent.initial(openFirstPage: false)),),- BlocListener<UserWorkspaceBloc, UserWorkspaceState>(- listener: (context, state) {- final actionType = state.actionResult?.actionType;-- if (actionType == UserWorkspaceActionType.create ||- actionType == UserWorkspaceActionType.delete ||- actionType == UserWorkspaceActionType.open) {- if (context.read<SpaceBloc>().state.spaces.isEmpty) {- context.read<SidebarSectionsBloc>().add(- SidebarSectionsEvent.reload(- userProfile,- state.currentWorkspace?.workspaceId ??- workspaceSetting.workspaceId,- ),- );+ ],+ child: MultiBlocListener(+ listeners: [+ BlocListener<SidebarSectionsBloc, SidebarSectionsState>(+ listenWhen: (p, c) =>+ p.lastCreatedRootView?.id != c.lastCreatedRootView?.id,+ listener: (context, state) => context.read<TabsBloc>().add(+ TabsEvent.openPlugin(+ plugin: state.lastCreatedRootView!.plugin(),+ ),+ ),+ ),+ BlocListener<SpaceBloc, SpaceState>(+ listenWhen: (prev, curr) =>+ prev.lastCreatedPage?.id != curr.lastCreatedPage?.id ||+ prev.isDuplicatingSpace != curr.isDuplicatingSpace,+ listener: (context, state) {+ final page = state.lastCreatedPage;+ if (page == null || page.id.isEmpty) {+ // open the blank page+ context+ .read<TabsBloc>()+ .add(TabsEvent.openPlugin(plugin: BlankPagePlugin()));} else {- context.read<SpaceBloc>().add(- SpaceEvent.reset(- userProfile,- state.currentWorkspace?.workspaceId ??- workspaceSetting.workspaceId,- true,+ context.read<TabsBloc>().add(+ TabsEvent.openPlugin(+ plugin: state.lastCreatedPage!.plugin(),),);}- context- .read<FavoriteBloc>()- .add(const FavoriteEvent.fetchFavorites());- }- },- ),- ],- child: _Sidebar(userProfile: userProfile),- ),- );- },+ if (state.isDuplicatingSpace) {+ _duplicateSpaceLoading ??= Loading(context);+ _duplicateSpaceLoading?.start();+ } else if (_duplicateSpaceLoading != null) {+ _duplicateSpaceLoading?.stop();+ _duplicateSpaceLoading = null;+ }+ },+ ),+ BlocListener<ActionNavigationBloc, ActionNavigationState>(+ listenWhen: (_, curr) => curr.action != null,+ listener: _onNotificationAction,+ ),+ BlocListener<UserWorkspaceBloc, UserWorkspaceState>(+ listener: (context, state) {+ final actionType = state.actionResult?.actionType;++ if (actionType == UserWorkspaceActionType.create ||+ actionType == UserWorkspaceActionType.delete ||+ actionType == UserWorkspaceActionType.open) {+ if (context.read<SpaceBloc>().state.spaces.isEmpty) {+ context.read<SidebarSectionsBloc>().add(+ SidebarSectionsEvent.reload(+ userProfile,+ state.currentWorkspace?.workspaceId ??+ workspaceSetting.workspaceId,+ ),+ );+ } else {+ context.read<SpaceBloc>().add(+ SpaceEvent.reset(+ userProfile,+ state.currentWorkspace?.workspaceId ??+ workspaceSetting.workspaceId,+ true,+ ),+ );+ }++ context+ .read<FavoriteBloc>()+ .add(const FavoriteEvent.fetchFavorites());+ }+ },+ ),+ ],+ child: _Sidebar(userProfile: userProfile),+ ),+ );+ },+ ),);}diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.jsonindex fc26fe7e60..edef7529b2 100644--- a/frontend/resources/translations/en.json+++ b/frontend/resources/translations/en.json@@ -1648,14 +1648,15 @@"file": "File"},"subPage": {- "name": "Insert page",+ "name": "Document","keyword1": "sub page","keyword2": "page","keyword3": "child page","keyword4": "insert page","keyword5": "embed page","keyword6": "new page",- "keyword7": "create page"+ "keyword7": "create page",+ "keyword8": "document"}},"selectionMenu": {@@ -2825,4 +2826,4 @@"many": "{count} members","other": "{count} members"}-}\ No newline at end of file+}