Skip to content

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.

fix: disable collaborators in local mode (#5043)

Lucas.Xue022ee88dace
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<AuthService>().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<DocumentAwarenessMetadata> 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<DocumentCollaboratorsBloc, DocumentCollaboratorsState>(
builder: (context, state) {
final collaborators = state.collaborators;
- if (collaborators.isEmpty) {
+ if (!state.shouldShowIndicator || collaborators.isEmpty) {
return const SizedBox.shrink();
}