From e022ee88daceab5be3e2f22e0456e6ceb16a5b53 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Wed, 3 Apr 2024 10:30:22 +0800 Subject: [PATCH] fix: disable collaborators in local mode (#5043) --- .../document/application/doc_collaborators_bloc.dart | 11 ++++++++--- .../document/presentation/document_collaborators.dart | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/doc_collaborators_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/application/doc_collaborators_bloc.dart index 902476d4c0..92fdfa001b 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/doc_collaborators_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/doc_collaborators_bloc.dart @@ -29,12 +29,16 @@ class DocumentCollaboratorsBloc initial: () async { final result = await getIt().getUser(); final userProfile = result.fold((s) => s, (f) => null); + if (userProfile == null || + userProfile.authenticator == AuthenticatorPB.Local) { + emit( + state.copyWith(shouldShowIndicator: false), + ); + return; + } final deviceId = ApplicationInfo.deviceId; _listener.start( onDocAwarenessUpdate: (states) { - if (userProfile == null) { - return; - } add( DocumentCollaboratorsEvent.update( userProfile, @@ -114,6 +118,7 @@ class DocumentCollaboratorsEvent with _$DocumentCollaboratorsEvent { class DocumentCollaboratorsState with _$DocumentCollaboratorsState { const factory DocumentCollaboratorsState({ @Default([]) List collaborators, + @Default(false) bool shouldShowIndicator, }) = _DocumentCollaboratorsState; factory DocumentCollaboratorsState.initial() => diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart index c67a038302..28d61a23a2 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart @@ -31,7 +31,7 @@ class DocumentCollaborators extends StatelessWidget { child: BlocBuilder( builder: (context, state) { final collaborators = state.collaborators; - if (collaborators.isEmpty) { + if (!state.shouldShowIndicator || collaborators.isEmpty) { return const SizedBox.shrink(); }