mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: disable collaborators in local mode (#5043)
This commit is contained in:
parent
dff3ea60bd
commit
e022ee88da
@ -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() =>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user