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: user rename
Nathanf0875d6b6e28
diff --git a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_bottom_sheet.dart b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_bottom_sheet.dartindex 1f1b2ddf4c..70bfa72e60 100644--- a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_bottom_sheet.dart+++ b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_bottom_sheet.dart@@ -54,7 +54,7 @@ class _PromptInputMobileSelectSourcesButtonStateWidget build(BuildContext context) {return BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(builder: (context, state) {- final userProfile = context.read<UserWorkspaceBloc>().userProfile;+ final userProfile = context.read<UserWorkspaceBloc>().state.userProfile;final workspaceId = state.currentWorkspace?.workspaceId ?? '';return MultiBlocProvider(providers: [diff --git a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_menu.dart b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_menu.dartindex 51357e6a0b..28c68f2e0b 100644--- a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_menu.dart+++ b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_menu.dart@@ -60,7 +60,7 @@ class _PromptInputDesktopSelectSourcesButtonState@overrideWidget build(BuildContext context) {final userWorkspaceBloc = context.read<UserWorkspaceBloc>();- final userProfile = userWorkspaceBloc.userProfile;+ final userProfile = userWorkspaceBloc.state.userProfile;final workspaceId =userWorkspaceBloc.state.currentWorkspace?.workspaceId ?? '';diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_message_selector_banner.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_message_selector_banner.dartindex 790a3fac3c..bebcc01d6d 100644--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_message_selector_banner.dart+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_message_selector_banner.dart@@ -134,7 +134,7 @@ class _SaveToPageButtonState extends State<SaveToPageButton> {@overrideWidget build(BuildContext context) {final userWorkspaceBloc = context.read<UserWorkspaceBloc>();- final userProfile = userWorkspaceBloc.userProfile;+ final userProfile = userWorkspaceBloc.state.userProfile;final workspaceId =userWorkspaceBloc.state.currentWorkspace?.workspaceId ?? '';diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dartindex 4951947108..738e8c9574 100644--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart@@ -516,7 +516,7 @@ class _SaveToPageButtonState extends State<SaveToPageButton> {@overrideWidget build(BuildContext context) {final userWorkspaceBloc = context.read<UserWorkspaceBloc>();- final userProfile = userWorkspaceBloc.userProfile;+ final userProfile = userWorkspaceBloc.state.userProfile;final workspaceId =userWorkspaceBloc.state.currentWorkspace?.workspaceId ?? '';diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dartindex d11d943066..0e270a5a08 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart@@ -144,7 +144,7 @@ class _ImageMenuState extends State<ImageMenu> {showDialog(context: context,builder: (_) => InteractiveImageViewer(- userProfile: context.read<UserWorkspaceBloc?>()?.userProfile ??+ userProfile: context.read<UserWorkspaceBloc?>()?.state.userProfile ??context.read<DocumentBloc>().state.userProfilePB,imageProvider: AFBlockImageProvider(images: [diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dartindex eb8ddba0b8..a8637c9c2c 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart@@ -53,7 +53,7 @@ class _ImageBrowserLayoutState extends State<ImageBrowserLayout> {@overridevoid initState() {super.initState();- _userProfile = context.read<UserWorkspaceBloc?>()?.userProfile ??+ _userProfile = context.read<UserWorkspaceBloc?>()?.state.userProfile ??context.read<DocumentBloc>().state.userProfilePB;}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dartindex da37945bf5..df617e4d44 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart@@ -73,7 +73,7 @@ class _ResizableImageState extends State<ResizableImage> {imageWidth = widget.width;- _userProfilePB = context.read<UserWorkspaceBloc?>()?.userProfile ??+ _userProfilePB = context.read<UserWorkspaceBloc?>()?.state.userProfile ??context.read<DocumentBloc>().state.userProfilePB;}diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dartindex febb89727a..58804bbcc0 100644--- a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart@@ -4,6 +4,7 @@ import 'package:appflowy/workspace/application/settings/cloud_setting_listener.dimport 'package:appflowy_backend/dispatch/dispatch.dart';import 'package:appflowy_backend/log.dart';import 'package:appflowy_backend/protobuf/flowy-user/user_setting.pb.dart';+import 'package:appflowy_backend/protobuf/flowy-user/workspace.pb.dart';import 'package:appflowy_result/appflowy_result.dart';import 'package:easy_localization/easy_localization.dart';import 'package:flutter_bloc/flutter_bloc.dart';@@ -17,6 +18,7 @@ class AppFlowyCloudSettingBloc: _listener = UserCloudConfigListener(),super(AppFlowyCloudSettingState.initial(setting, false)) {_dispatch();+ _getWorkspaceType();}final UserCloudConfigListener _listener;@@ -27,6 +29,23 @@ class AppFlowyCloudSettingBlocreturn super.close();}+ void _getWorkspaceType() {+ UserEventGetUserProfile().send().then((value) {+ if (isClosed) {+ return;+ }++ value.fold(+ (profile) => add(+ AppFlowyCloudSettingEvent.workspaceTypeChanged(+ profile.workspaceType,+ ),+ ),+ (error) => Log.error(error),+ );+ });+ }+void _dispatch() {on<AppFlowyCloudSettingEvent>((event, emit) async {@@ -65,6 +84,9 @@ class AppFlowyCloudSettingBloc),);},+ workspaceTypeChanged: (WorkspaceTypePB workspaceType) {+ emit(state.copyWith(workspaceType: workspaceType));+ },);},);@@ -81,6 +103,9 @@ class AppFlowyCloudSettingEvent with _$AppFlowyCloudSettingEvent {const factory AppFlowyCloudSettingEvent.didReceiveSetting(CloudSettingPB setting,) = _DidUpdateSetting;+ const factory AppFlowyCloudSettingEvent.workspaceTypeChanged(+ WorkspaceTypePB workspaceType,+ ) = _WorkspaceTypeChanged;}@freezed@@ -89,6 +114,7 @@ class AppFlowyCloudSettingState with _$AppFlowyCloudSettingState {required CloudSettingPB setting,required bool showRestartHint,required bool isSyncLogEnabled,+ required WorkspaceTypePB workspaceType,}) = _AppFlowyCloudSettingState;factory AppFlowyCloudSettingState.initial(@@ -99,6 +125,7 @@ class AppFlowyCloudSettingState with _$AppFlowyCloudSettingState {setting: setting,showRestartHint: setting.serverUrl.isNotEmpty,isSyncLogEnabled: isSyncLogEnabled,+ workspaceType: WorkspaceTypePB.ServerW,);}diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dartindex 6540b41c9a..8c5b1efde3 100644--- a/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart@@ -31,7 +31,7 @@ enum SettingsPage {class SettingsDialogBlocextends Bloc<SettingsDialogEvent, SettingsDialogState> {SettingsDialogBloc(- this.userProfile,+ UserProfilePB userProfile,this.currentWorkspaceMemberRole, {SettingsPage? initPage,}) : _userListener = UserListener(userProfile: userProfile),@@ -39,7 +39,6 @@ class SettingsDialogBloc_dispatch();}- final UserProfilePB userProfile;final AFRolePB? currentWorkspaceMemberRole;final UserListener _userListener;@@ -57,7 +56,7 @@ class SettingsDialogBloc_userListener.start(onProfileUpdated: _profileUpdated);final isBillingEnabled = await _isBillingEnabled(- userProfile,+ state.userProfile,currentWorkspaceMemberRole,);if (isBillingEnabled) {@@ -79,8 +78,11 @@ class SettingsDialogBlocFlowyResult<UserProfilePB, FlowyError> userProfileOrFailed,) {userProfileOrFailed.fold(- (newUserProfile) =>- add(SettingsDialogEvent.didReceiveUserProfile(newUserProfile)),+ (newUserProfile) {+ if (!isClosed) {+ add(SettingsDialogEvent.didReceiveUserProfile(newUserProfile));+ }+ },(err) => Log.error(err),);}diff --git a/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dartindex 23835e7952..611cf55836 100644--- a/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart@@ -19,16 +19,25 @@ part 'user_workspace_bloc.freezed.dart';class UserWorkspaceBloc extends Bloc<UserWorkspaceEvent, UserWorkspaceState> {UserWorkspaceBloc({- required this.userProfile,+ required UserProfilePB userProfile,this.initialWorkspaceId,}) : _userService = UserBackendService(userId: userProfile.id),_listener = UserListener(userProfile: userProfile),- super(UserWorkspaceState.initial()) {+ super(UserWorkspaceState.initial(userProfile)) {on<UserWorkspaceEvent>((event, emit) async {await event.when(initial: () async {_listener.start(+ onProfileUpdated: (result) {+ if (!isClosed) {+ result.fold(+ (newProfile) =>+ add(UserWorkspaceEvent.updateUserProfile(newProfile)),+ (error) => Log.error("Failed to get user profile: $error"),+ );+ }+ },onUserWorkspaceListUpdated: (workspaces) =>add(UserWorkspaceEvent.updateWorkspaces(workspaces)),onUserWorkspaceUpdated: (workspace) {@@ -423,6 +432,13 @@ class UserWorkspaceBloc extends Bloc<UserWorkspaceEvent, UserWorkspaceState> {),);},+ updateUserProfile: (newUserProfile) {+ emit(+ state.copyWith(+ userProfile: newUserProfile,+ ),+ );+ },);},);@@ -434,7 +450,6 @@ class UserWorkspaceBloc extends Bloc<UserWorkspaceEvent, UserWorkspaceState> {return super.close();}- final UserProfilePB userProfile;final UserBackendService _userService;final UserListener _listener;final String? initialWorkspaceId;@@ -510,6 +525,9 @@ class UserWorkspaceEvent with _$UserWorkspaceEvent {const factory UserWorkspaceEvent.updateCurrentWorkspace(UserWorkspacePB workspace,) = UpdateCurrentWorkspace;+ const factory UserWorkspaceEvent.updateUserProfile(+ UserProfilePB userProfile,+ ) = UpdateUserProfile;}enum UserWorkspaceActionType {@@ -549,9 +567,13 @@ class UserWorkspaceState with _$UserWorkspaceState {@Default([]) List<UserWorkspacePB> workspaces,@Default(null) UserWorkspaceActionResult? actionResult,@Default(false) bool isCollabWorkspaceOn,+ required UserProfilePB userProfile,}) = _UserWorkspaceState;- factory UserWorkspaceState.initial() => const UserWorkspaceState();+ factory UserWorkspaceState.initial(UserProfilePB userProfile) =>+ UserWorkspaceState(+ userProfile: userProfile,+ );@overrideint get hashCode => runtimeType.hashCode;@@ -566,6 +588,7 @@ class UserWorkspaceState with _$UserWorkspaceState {return other is UserWorkspaceState &&other.currentWorkspace == currentWorkspace &&_deepCollectionEquality.equals(other.workspaces, workspaces) &&- identical(other.actionResult, actionResult);+ identical(other.actionResult, actionResult) &&+ other.userProfile == userProfile;}}diff --git a/frontend/appflowy_flutter/lib/workspace/application/view_info/view_info_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/view_info/view_info_bloc.dartindex 27540622ba..8bdeb0fbc1 100644--- a/frontend/appflowy_flutter/lib/workspace/application/view_info/view_info_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/view_info/view_info_bloc.dart@@ -1,6 +1,9 @@import 'package:appflowy/util/int64_extension.dart';import 'package:appflowy/util/string_extension.dart';+import 'package:appflowy_backend/dispatch/dispatch.dart';+import 'package:appflowy_backend/log.dart';import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';+import 'package:appflowy_backend/protobuf/flowy-user/workspace.pb.dart';import 'package:appflowy_editor/appflowy_editor.dart';import 'package:bloc/bloc.dart';import 'package:freezed_annotation/freezed_annotation.dart';@@ -49,6 +52,22 @@ class ViewInfoBloc extends Bloc<ViewInfoEvent, ViewInfoState> {),);},+ workspaceTypeChanged: (s) {+ emit(+ state.copyWith(workspaceType: s),+ );+ },+ );+ });++ UserEventGetUserProfile().send().then((value) {+ value.fold(+ (s) {+ if (!isClosed) {+ add(ViewInfoEvent.workspaceTypeChanged(s.workspaceType));+ }+ },+ (e) => Log.error('Failed to get user profile: $e'),);});}@@ -86,6 +105,10 @@ class ViewInfoEvent with _$ViewInfoEvent {const factory ViewInfoEvent.wordCountChanged() = _WordCountChanged;const factory ViewInfoEvent.titleChanged(String title) = _TitleChanged;++ const factory ViewInfoEvent.workspaceTypeChanged(+ WorkspaceTypePB workspaceType,+ ) = _WorkspaceTypeChanged;}@freezed@@ -94,11 +117,13 @@ class ViewInfoState with _$ViewInfoState {required Counters? documentCounters,required Counters? titleCounters,required DateTime? createdAt,+ required WorkspaceTypePB? workspaceType,}) = _ViewInfoState;factory ViewInfoState.initial() => const ViewInfoState(documentCounters: null,titleCounters: null,createdAt: null,+ workspaceType: null,);}diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dartindex c2ea3482c7..c582ee292e 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart@@ -206,7 +206,7 @@ class _HomeHotKeysState extends State<HomeHotKeys> {),// Open settings dialog- openSettingsHotKey(context, widget.userProfile),+ openSettingsHotKey(context),];@overridediff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dartindex 05e6d46957..bce00d9792 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart@@ -105,7 +105,6 @@ class SidebarToast extends StatelessWidget {if (role.isOwner) {showSettingsDialog(context,- userProfile: userProfile,userWorkspaceBloc: userWorkspaceBloc,initPage: SettingsPage.plan,);diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/header/sidebar_user.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/header/sidebar_user.dartindex 524934aa82..707b6c2c75 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/header/sidebar_user.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/header/sidebar_user.dart@@ -44,7 +44,7 @@ class SidebarUser extends StatelessWidget {),const HSpace(8),Expanded(child: _buildUserName(context, state)),- UserSettingButton(userProfile: state.userProfile),+ UserSettingButton(),const HSpace(8.0),const NotificationButton(),const HSpace(10.0),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dartindex 0bd5dafe91..d1e32985fa 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dart@@ -9,8 +9,6 @@ import 'package:appflowy/workspace/presentation/home/af_focus_manager.dart';import 'package:appflowy/workspace/presentation/home/hotkeys.dart';import 'package:appflowy/workspace/presentation/settings/settings_dialog.dart';import 'package:appflowy_backend/log.dart';-import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'- show UserProfilePB;import 'package:easy_localization/easy_localization.dart';import 'package:flowy_infra_ui/flowy_infra_ui.dart';import 'package:flutter/material.dart';@@ -22,7 +20,6 @@ final GlobalKey _settingsDialogKey = GlobalKey();HotKeyItem openSettingsHotKey(BuildContext context,- UserProfilePB userProfile,) =>HotKeyItem(hotKey: HotKey(@@ -34,7 +31,7 @@ HotKeyItem openSettingsHotKey(),keyDownHandler: (_) {if (_settingsDialogKey.currentContext == null) {- showSettingsDialog(context, userProfile: userProfile);+ showSettingsDialog(context);} else {Navigator.of(context, rootNavigator: true).popUntil((route) => route.isFirst);@@ -45,11 +42,9 @@ HotKeyItem openSettingsHotKey(class UserSettingButton extends StatefulWidget {const UserSettingButton({super.key,- required this.userProfile,this.isHover = false,});- final UserProfilePB userProfile;final bool isHover;@override@@ -65,7 +60,7 @@ class _UserSettingButtonState extends State<UserSettingButton> {super.initState();_userWorkspaceBloc = context.read<UserWorkspaceBloc>();- _passwordBloc = PasswordBloc(widget.userProfile)+ _passwordBloc = PasswordBloc(_userWorkspaceBloc.state.userProfile)..add(PasswordEvent.init())..add(PasswordEvent.checkHasPassword());}@@ -95,7 +90,6 @@ class _UserSettingButtonState extends State<UserSettingButton> {child: FlowyButton(onTap: () => showSettingsDialog(context,- userProfile: widget.userProfile,userWorkspaceBloc: _userWorkspaceBloc,passwordBloc: _passwordBloc,),@@ -116,7 +110,6 @@ class _UserSettingButtonState extends State<UserSettingButton> {void showSettingsDialog(BuildContext context, {- required UserProfilePB userProfile,UserWorkspaceBloc? userWorkspaceBloc,PasswordBloc? passwordBloc,SettingsPage? initPage,@@ -132,7 +125,9 @@ void showSettingsDialog(value: passwordBloc,): BlocProvider(- create: (context) => PasswordBloc(userProfile)+ create: (context) => PasswordBloc(+ context.read<UserWorkspaceBloc>().state.userProfile,+ )..add(PasswordEvent.init())..add(PasswordEvent.checkHasPassword()),),@@ -144,7 +139,7 @@ void showSettingsDialog(),],child: SettingsDialog(- userProfile,+ context.read<UserWorkspaceBloc>().state.userProfile,initPage: initPage,didLogout: () async {// Pop the dialog using the dialog contextdiff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dartindex f19e1076ba..cc1577aeba 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart@@ -83,7 +83,6 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {),),UserSettingButton(- userProfile: widget.userProfile,isHover: onHover,),const HSpace(8.0),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dartindex f73b83a10f..8c8123b8d0 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart@@ -94,21 +94,17 @@ class SettingsDialog extends StatelessWidget {axis: Axis.vertical,color: theme.borderColorScheme.primary,),- Expanded(- child: getSettingsView(- context- .read<UserWorkspaceBloc>()- .state- .currentWorkspace!- .workspaceId,- context.read<SettingsDialogBloc>().state.page,- context.read<SettingsDialogBloc>().state.userProfile,- context- .read<UserWorkspaceBloc>()- .state- .currentWorkspace- ?.role,- ),+ BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(+ builder: (context, state) {+ return Expanded(+ child: getSettingsView(+ state.currentWorkspace!.workspaceId,+ context.read<SettingsDialogBloc>().state.page,+ state.userProfile,+ state.currentWorkspace?.role,+ ),+ );+ },),],),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dartindex 5f158f4ae1..bd89254be7 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart@@ -69,7 +69,8 @@ class AppFlowyCloudViewSetting extends StatelessWidget {return Column(children: [const VSpace(8),- const AppFlowyCloudEnableSync(),+ if (state.workspaceType == WorkspaceTypePB.ServerW)+ const AppFlowyCloudEnableSync(),const VSpace(6),// const AppFlowyCloudSyncLogEnabled(),const VSpace(12),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/more_view_actions/more_view_actions.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/more_view_actions/more_view_actions.dartindex 7621d6b0a4..2d302613ed 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/more_view_actions/more_view_actions.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/more_view_actions/more_view_actions.dart@@ -66,7 +66,7 @@ class _MoreViewActionsState extends State<MoreViewActions> {Widget _buildPopup(ViewInfoState viewInfoState) {final userWorkspaceBloc = context.read<UserWorkspaceBloc>();- final userProfile = userWorkspaceBloc.userProfile;+ final userProfile = userWorkspaceBloc.state.userProfile;final workspaceId =userWorkspaceBloc.state.currentWorkspace?.workspaceId ?? '';@@ -142,7 +142,8 @@ class _MoreViewActionsState extends State<MoreViewActions> {mutex: popoverMutex,),],- if (widget.view.isDocument || widget.view.isDatabase) ...[+ if (state.workspaceType == WorkspaceTypePB.ServerW &&+ (widget.view.isDocument || widget.view.isDatabase)) ...[LockPageAction(view: view,),diff --git a/frontend/rust-lib/flowy-user/src/entities/workspace.rs b/frontend/rust-lib/flowy-user/src/entities/workspace.rsindex 3e82d732fe..cdad76525d 100644--- a/frontend/rust-lib/flowy-user/src/entities/workspace.rs+++ b/frontend/rust-lib/flowy-user/src/entities/workspace.rs@@ -10,7 +10,6 @@ use flowy_user_pub::cloud::{AFWorkspaceSettings, AFWorkspaceSettingsChange};use flowy_user_pub::entities::{AuthType, Role, WorkspaceInvitation, WorkspaceMember, WorkspaceType,};-use flowy_user_pub::sql::WorkspaceSettingsTable;use lib_infra::validator_fn::required_not_empty_str;#[derive(ProtoBuf, Default, Clone)]@@ -485,6 +484,9 @@ pub struct WorkspaceSettingsPB {#[pb(index = 2)]pub ai_model: String,++ #[pb(index = 3)]+ pub workspace_type: WorkspaceTypePB,}impl From<&AFWorkspaceSettings> for WorkspaceSettingsPB {@@ -492,15 +494,7 @@ impl From<&AFWorkspaceSettings> for WorkspaceSettingsPB {Self {disable_search_indexing: value.disable_search_indexing,ai_model: value.ai_model.clone(),- }- }-}--impl From<WorkspaceSettingsTable> for WorkspaceSettingsPB {- fn from(value: WorkspaceSettingsTable) -> Self {- Self {- disable_search_indexing: value.disable_search_indexing,- ai_model: value.ai_model,+ workspace_type: WorkspaceTypePB::ServerW,}}}diff --git a/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs b/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rsindex 137e55eefa..c6294e6fdc 100644--- a/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs+++ b/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs@@ -8,6 +8,7 @@ use std::sync::Arc;use crate::entities::{RepeatedUserWorkspacePB, SubscribeWorkspacePB, SuccessWorkspaceSubscriptionPB,UpdateUserWorkspaceSettingPB, UserWorkspacePB, WorkspaceSettingsPB, WorkspaceSubscriptionInfoPB,+ WorkspaceTypePB,};use crate::notification::{send_notification, UserNotification};use crate::services::billing_check::PeriodicallyCheckBillingState;@@ -618,10 +619,16 @@ impl UserManager {) -> FlowyResult<WorkspaceSettingsPB> {let uid = self.user_id()?;let mut conn = self.db_connection(uid)?;- match select_workspace_setting(&mut conn, &workspace_id.to_string()) {+ let workspace_id_str = workspace_id.to_string();+ let workspace_type = select_user_workspace_type(&workspace_id_str, &mut conn)?;+ match select_workspace_setting(&mut conn, &workspace_id_str) {Ok(workspace_settings) => {trace!("workspace settings found in local db");- let pb = WorkspaceSettingsPB::from(workspace_settings);+ let pb = WorkspaceSettingsPB {+ disable_search_indexing: workspace_settings.disable_search_indexing,+ ai_model: workspace_settings.ai_model,+ workspace_type: WorkspaceTypePB::from(workspace_type),+ };let old_pb = pb.clone();let workspace_id = *workspace_id;