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.

feat: integrate guest role (#7967)

Lucas289cf2526d7d
diff --git a/frontend/appflowy_flutter/integration_test/desktop/uncategorized/zoom_in_out_test.dart b/frontend/appflowy_flutter/integration_test/desktop/uncategorized/zoom_in_out_test.dart
index f0cddadf68..a7e32065b1 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/uncategorized/zoom_in_out_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/uncategorized/zoom_in_out_test.dart
@@ -56,6 +56,9 @@ void main() {
await tester.pumpAndSettle();
currentScaleFactor += 0.1;
+ currentScaleFactor = double.parse(
+ currentScaleFactor.toStringAsFixed(2),
+ );
final scaleFactor = await windowSizeManager.getScaleFactor();
expect(currentScaleFactor, appflowyScaleFactor);
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/local_share_with_user_repository.dart b/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/local_share_with_user_repository.dart
index 092535922b..e6a34137bb 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/local_share_with_user_repository.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/local_share_with_user_repository.dart
@@ -145,7 +145,7 @@ class LocalShareWithUserRepository extends ShareWithUserRepository {
@override
Future<FlowyResult<void, FlowyError>> changeRole({
- required String pageId,
+ required String workspaceId,
required String email,
required ShareRole role,
}) async {
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/rust_share_with_user_repository.dart b/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/rust_share_with_user_repository.dart
index acadb0bff7..130c4d460c 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/rust_share_with_user_repository.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/rust_share_with_user_repository.dart
@@ -23,7 +23,7 @@ class RustShareWithUserRepository extends ShareWithUserRepository {
return result.fold(
(success) {
- Log.info('get shared users: $success');
+ Log.debug('get shared users: $success');
return FlowySuccess(success.sharedUsers);
},
@@ -93,30 +93,31 @@ class RustShareWithUserRepository extends ShareWithUserRepository {
Future<FlowyResult<SharedUsers, FlowyError>> getAvailableSharedUsers({
required String pageId,
}) async {
- // TODO: Implement this
return FlowySuccess([]);
}
@override
Future<FlowyResult<void, FlowyError>> changeRole({
- required String pageId,
+ required String workspaceId,
required String email,
required ShareRole role,
}) async {
final request = UpdateWorkspaceMemberPB(
- workspaceId: pageId,
+ workspaceId: workspaceId,
email: email,
role: role.userRole,
);
final result = await UserEventUpdateWorkspaceMember(request).send();
return result.fold(
(success) {
- Log.info('change role($role) for user($email) in page($pageId)');
+ Log.info(
+ 'change role($role) for user($email) in workspaceId($workspaceId)',
+ );
return FlowySuccess(success);
},
(failure) {
Log.error(
- 'failed to change role($role) for user($email) in page($pageId)',
+ 'failed to change role($role) for user($email) in workspaceId($workspaceId)',
failure,
);
return FlowyFailure(failure);
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/share_with_user_repository.dart b/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/share_with_user_repository.dart
index 9f3cb4d14e..d8a1e88a3e 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/share_with_user_repository.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/data/repositories/share_with_user_repository.dart
@@ -34,7 +34,7 @@ abstract class ShareWithUserRepository {
/// Change the role of a user in a shared page.
Future<FlowyResult<void, FlowyError>> changeRole({
- required String pageId,
+ required String workspaceId,
required String email,
required ShareRole role,
});
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/logic/share_with_user_bloc.dart b/frontend/appflowy_flutter/lib/features/share_tab/logic/share_with_user_bloc.dart
index a69c20d36c..55511a48df 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/logic/share_with_user_bloc.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/logic/share_with_user_bloc.dart
@@ -2,6 +2,7 @@ import 'package:appflowy/features/share_tab/data/models/models.dart';
import 'package:appflowy/features/share_tab/data/repositories/share_with_user_repository.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/clipboard_service.dart';
import 'package:appflowy/plugins/shared/share/constants.dart';
+import 'package:appflowy/shared/feature_flags.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/user/application/user_service.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
@@ -37,6 +38,17 @@ class ShareWithUserBloc extends Bloc<ShareWithUserEvent, ShareWithUserState> {
Initial event,
Emitter<ShareWithUserState> emit,
) async {
+ if (!FeatureFlag.sharedSection.isOn) {
+ emit(
+ state.copyWith(
+ errorMessage: 'Sharing is currently disabled.',
+ users: [],
+ isLoading: false,
+ ),
+ );
+ return;
+ }
+
final result = await UserBackendService.getCurrentUserProfile();
final currentUser = result.fold(
(user) => user,
@@ -63,6 +75,10 @@ class ShareWithUserBloc extends Bloc<ShareWithUserEvent, ShareWithUserState> {
GetSharedUsers event,
Emitter<ShareWithUserState> emit,
) async {
+ if (!FeatureFlag.sharedSection.isOn) {
+ return;
+ }
+
emit(
state.copyWith(
errorMessage: '',
@@ -288,7 +304,7 @@ class ShareWithUserBloc extends Bloc<ShareWithUserEvent, ShareWithUserState> {
);
final result = await repository.changeRole(
- pageId: pageId,
+ workspaceId: workspaceId,
email: event.email,
role: ShareRole.member,
);
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/presentation/share_tab.dart b/frontend/appflowy_flutter/lib/features/share_tab/presentation/share_tab.dart
index 03dc3c729b..3344bb5be5 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/presentation/share_tab.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/presentation/share_tab.dart
@@ -1,10 +1,12 @@
-import 'package:appflowy/features/share_tab/data/models/share_access_level.dart';
+import 'package:appflowy/features/share_tab/data/models/models.dart';
import 'package:appflowy/features/share_tab/logic/share_with_user_bloc.dart';
import 'package:appflowy/features/share_tab/presentation/widgets/copy_link_widget.dart';
import 'package:appflowy/features/share_tab/presentation/widgets/people_with_access_section.dart';
import 'package:appflowy/features/share_tab/presentation/widgets/share_with_user_widget.dart';
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
+import 'package:appflowy_backend/protobuf/flowy-error/code.pbenum.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
+import 'package:collection/collection.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -46,20 +48,29 @@ class _ShareTabState extends State<ShareTab> {
return const SizedBox.shrink();
}
+ final currentUserRole = state.users
+ .firstWhereOrNull(
+ (user) => user.email == state.currentUser?.email,
+ )
+ ?.role;
+
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// share page with user by email
- VSpace(theme.spacing.l),
- ShareWithUserWidget(
- controller: controller,
- onInvite: (emails) => _onSharePageWithUser(
- context,
- emails: emails,
- accessLevel: ShareAccessLevel.readOnly,
+ // hide this when the user is guest
+ if (currentUserRole != ShareRole.guest) ...[
+ VSpace(theme.spacing.l),
+ ShareWithUserWidget(
+ controller: controller,
+ onInvite: (emails) => _onSharePageWithUser(
+ context,
+ emails: emails,
+ accessLevel: ShareAccessLevel.readOnly,
+ ),
),
- ),
+ ],
// shared users
@@ -104,7 +115,12 @@ class _ShareTabState extends State<ShareTab> {
) {
return PeopleWithAccessSectionCallbacks(
onSelectAccessLevel: (user, accessLevel) {
- // do nothing. the event doesn't support in the backend yet
+ context.read<ShareWithUserBloc>().add(
+ ShareWithUserEvent.updateAccessLevel(
+ email: user.email,
+ accessLevel: accessLevel,
+ ),
+ );
},
onTurnIntoMember: (user) {
context.read<ShareWithUserBloc>().add(
@@ -133,9 +149,22 @@ class _ShareTabState extends State<ShareTab> {
message: 'Invitation sent',
);
}, (error) {
- // TODO: handle the limiation error
+ String message;
+ switch (error.code) {
+ case ErrorCode.InvalidGuest:
+ message = 'The email is already in the list';
+ break;
+ case ErrorCode.FreePlanGuestLimitExceeded:
+ message = 'Please upgrade to a Pro plan to invite more guests';
+ break;
+ case ErrorCode.PaidPlanGuestLimitExceeded:
+ message = 'You have reached the maximum number of guests';
+ break;
+ default:
+ message = error.msg;
+ }
showToastNotification(
- message: error.msg,
+ message: message,
type: ToastificationType.error,
);
});
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/access_level_list_widget.dart b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/access_level_list_widget.dart
index e54937fd0b..b648b43d49 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/access_level_list_widget.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/access_level_list_widget.dart
@@ -50,51 +50,34 @@ class AccessLevelListCallbacks {
class AccessLevelListWidget extends StatelessWidget {
const AccessLevelListWidget({
super.key,
- this.enableAccessLevelSelection = false,
required this.selectedAccessLevel,
required this.callbacks,
+ required this.supportedAccessLevels,
});
- /// Enable access level selection
- final bool enableAccessLevelSelection;
-
/// The currently selected access level
final ShareAccessLevel selectedAccessLevel;
/// Callbacks
final AccessLevelListCallbacks callbacks;
+ /// Supported access levels
+ final List<ShareAccessLevel> supportedAccessLevels;
+
@override
Widget build(BuildContext context) {
final theme = AppFlowyTheme.of(context);
return AFMenu(
- width: enableAccessLevelSelection ? 240 : 160,
+ width: supportedAccessLevels.isNotEmpty ? 240 : 160,
children: [
// Display all available access level options
- if (enableAccessLevelSelection) ...[
- _buildAccessLevelItem(
- context,
- accessLevel: ShareAccessLevel.fullAccess,
- onTap: () =>
- callbacks.onSelectAccessLevel(ShareAccessLevel.fullAccess),
- ),
- _buildAccessLevelItem(
- context,
- accessLevel: ShareAccessLevel.readAndWrite,
- onTap: () =>
- callbacks.onSelectAccessLevel(ShareAccessLevel.readAndWrite),
- ),
- _buildAccessLevelItem(
- context,
- accessLevel: ShareAccessLevel.readAndComment,
- onTap: () =>
- callbacks.onSelectAccessLevel(ShareAccessLevel.readAndComment),
- ),
- _buildAccessLevelItem(
- context,
- accessLevel: ShareAccessLevel.readOnly,
- onTap: () =>
- callbacks.onSelectAccessLevel(ShareAccessLevel.readOnly),
+ if (supportedAccessLevels.isNotEmpty) ...[
+ ...supportedAccessLevels.map(
+ (accessLevel) => _buildAccessLevelItem(
+ context,
+ accessLevel: accessLevel,
+ onTap: () => callbacks.onSelectAccessLevel(accessLevel),
+ ),
),
AFDivider(spacing: theme.spacing.m),
],
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/edit_access_level_widget.dart b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/edit_access_level_widget.dart
index 4bbef2d5fd..238f1ccd6f 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/edit_access_level_widget.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/edit_access_level_widget.dart
@@ -10,6 +10,7 @@ class EditAccessLevelWidget extends StatefulWidget {
super.key,
required this.callbacks,
required this.selectedAccessLevel,
+ required this.supportedAccessLevels,
this.disabled = false,
});
@@ -22,6 +23,9 @@ class EditAccessLevelWidget extends StatefulWidget {
/// Whether the widget is disabled
final bool disabled;
+ /// Supported access levels
+ final List<ShareAccessLevel> supportedAccessLevels;
+
@override
State<EditAccessLevelWidget> createState() => _EditAccessLevelWidgetState();
}
@@ -47,6 +51,7 @@ class _EditAccessLevelWidgetState extends State<EditAccessLevelWidget> {
popover: (_) {
return AccessLevelListWidget(
selectedAccessLevel: widget.selectedAccessLevel,
+ supportedAccessLevels: widget.supportedAccessLevels,
callbacks: widget.callbacks.copyWith(
onSelectAccessLevel: (accessLevel) {
widget.callbacks.onSelectAccessLevel(accessLevel);
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_group_widget.dart b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_group_widget.dart
index 6672143804..2b372be2cd 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_group_widget.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_group_widget.dart
@@ -74,6 +74,7 @@ class SharedGroupWidget extends StatelessWidget {
Widget _buildTrailing(BuildContext context) {
return EditAccessLevelWidget(
disabled: true,
+ supportedAccessLevels: ShareAccessLevel.values,
selectedAccessLevel: ShareAccessLevel.fullAccess,
callbacks: AccessLevelListCallbacks.none(),
);
diff --git a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_user_widget.dart b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_user_widget.dart
index 0d7ddef6a3..12332f76c7 100644
--- a/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_user_widget.dart
+++ b/frontend/appflowy_flutter/lib/features/share_tab/presentation/widgets/shared_user_widget.dart
@@ -96,8 +96,22 @@ class SharedUserWidget extends StatelessWidget {
) {
final isCurrentUser = user.email == currentUser.email;
final theme = AppFlowyTheme.of(context);
+ // Guest: read and write, read only
+ // Member: full access <- only have full access until the backend supports more access levels
+ // Owner: all access levels
+ final supportedAccessLevels = switch (user.role) {
+ ShareRole.guest => [
+ ShareAccessLevel.readAndWrite,
+ ShareAccessLevel.readOnly,
+ ],
+ ShareRole.member => [ShareAccessLevel.fullAccess],
+ ShareRole.owner => [ShareAccessLevel.fullAccess],
+ };
// The current guest user can't edit the access level of the other user
- return isCurrentUser || currentUser.role == ShareRole.guest
+ return isCurrentUser ||
+ currentUser.role == ShareRole.guest ||
+ user.role == ShareRole.member ||
+ user.role == ShareRole.owner
? AFGhostTextButton.disabled(
text: user.accessLevel.i18n,
textStyle: theme.textStyle.body.standard(
@@ -106,6 +120,7 @@ class SharedUserWidget extends StatelessWidget {
)
: EditAccessLevelWidget(
selectedAccessLevel: user.accessLevel,
+ supportedAccessLevels: supportedAccessLevels,
callbacks: callbacks ?? AccessLevelListCallbacks.none(),
);
}
diff --git a/frontend/appflowy_flutter/lib/features/shared_section/presentation/shared_section.dart b/frontend/appflowy_flutter/lib/features/shared_section/presentation/shared_section.dart
index 93188afd79..80382ef63d 100644
--- a/frontend/appflowy_flutter/lib/features/shared_section/presentation/shared_section.dart
+++ b/frontend/appflowy_flutter/lib/features/shared_section/presentation/shared_section.dart
@@ -5,8 +5,18 @@ import 'package:appflowy/features/shared_section/presentation/widgets/shared_pag
import 'package:appflowy/features/shared_section/presentation/widgets/shared_section_error.dart';
import 'package:appflowy/features/shared_section/presentation/widgets/shared_section_header.dart';
import 'package:appflowy/features/shared_section/presentation/widgets/shared_section_loading.dart';
+import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:appflowy/workspace/application/favorite/favorite_bloc.dart';
+import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart';
+import 'package:appflowy/workspace/application/view/view_bloc.dart';
+import 'package:appflowy/workspace/application/view/view_ext.dart';
+import 'package:appflowy/workspace/application/view/view_service.dart';
+import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type.dart';
+import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class SharedSection extends StatelessWidget {
@@ -47,7 +57,52 @@ class SharedSection extends StatelessWidget {
const SharedSectionHeader(),
// Shared pages list
- SharedPagesList(sharedPages: state.sharedPages),
+ SharedPagesList(
+ sharedPages: state.sharedPages,
+ onSetEditing: (context, value) {
+ context.read<ViewBloc>().add(ViewEvent.setIsEditing(value));
+ },
+ onAction: (action, view, data) async {
+ switch (action) {
+ case ViewMoreActionType.favorite:
+ case ViewMoreActionType.unFavorite:
+ context
+ .read<FavoriteBloc>()
+ .add(FavoriteEvent.toggle(view));
+ break;
+ case ViewMoreActionType.openInNewTab:
+ context.read<TabsBloc>().openTab(view);
+ break;
+ case ViewMoreActionType.rename:
+ await NavigatorTextFieldDialog(
+ title: LocaleKeys.disclosureAction_rename.tr(),
+ autoSelectAllText: true,
+ value: view.nameOrDefault,
+ maxLength: 256,
+ onConfirm: (newValue, _) {
+ // can not use bloc here because it has been disposed.
+ ViewBackendService.updateView(
+ viewId: view.id,
+ name: newValue,
+ );
+ },
+ ).show(context);
+ break;
+ default:
+ // Other actions are not allowed for read-only access
+ break;
+ }
+ },
+ onSelected: (context, view) {
+ if (HardwareKeyboard.instance.isControlPressed) {
+ context.read<TabsBloc>().openTab(view);
+ }
+ context.read<TabsBloc>().openPlugin(view);
+ },
+ onTertiarySelected: (context, view) {
+ context.read<TabsBloc>().openTab(view);
+ },
+ ),
// Refresh button, for debugging only
if (kDebugMode)
diff --git a/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_page_actions_button.dart b/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_page_actions_button.dart
new file mode 100644
index 0000000000..0134d49b8b
--- /dev/null
+++ b/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_page_actions_button.dart
@@ -0,0 +1,154 @@
+import 'package:appflowy/features/share_tab/data/models/share_access_level.dart';
+import 'package:appflowy/generated/flowy_svgs.g.dart';
+import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:appflowy_ui/appflowy_ui.dart';
+import 'package:flutter/material.dart';
+
+typedef SharedPageActionsButtonCallback = void Function(
+ ViewMoreActionType type,
+ ViewPB view,
+ dynamic data,
+);
+
+typedef SharedPageActionsButtonSetEditingCallback = void Function(
+ BuildContext context,
+ bool value,
+);
+
+class SharedPageActionsButton extends StatefulWidget {
+ const SharedPageActionsButton({
+ super.key,
+ required this.view,
+ required this.accessLevel,
+ required this.onAction,
+ required this.buildChild,
+ required this.onSetEditing,
+ this.showAtCursor = false,
+ });
+
+ final ViewPB view;
+ final ShareAccessLevel accessLevel;
+ final SharedPageActionsButtonCallback onAction;
+ final SharedPageActionsButtonSetEditingCallback onSetEditing;
+ final bool showAtCursor;
+ final Widget Function(AFPopoverController) buildChild;
+
+ @override
+ State<SharedPageActionsButton> createState() =>
+ _SharedPageActionsButtonState();
+}
+
+class _SharedPageActionsButtonState extends State<SharedPageActionsButton> {
+ AFPopoverController controller = AFPopoverController();
+
+ @override
+ void initState() {
+ super.initState();
+
+ controller.addListener(() {
+ if (!controller.isOpen) {
+ widget.onSetEditing(context, false);
+ }
+ });
+ }
+
+ @override
+ void dispose() {
+ controller.dispose();
+
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return AFPopover(
+ controller: controller,
+ padding: EdgeInsets.zero,
+ decoration: BoxDecoration(), // the AFMenu has a border
+ anchor: const AFAnchorAuto(
+ offset: Offset(-8, 116),
+ followerAnchor: Alignment.centerRight,
+ targetAnchor: Alignment.centerLeft,
+ ),
+ popover: (context) => AFMenu(
+ width: 240,
+ children: _buildMenuItems(context),
+ ),
+ child: widget.buildChild(controller),
+ );
+ }
+
+ List<Widget> _buildMenuItems(BuildContext context) {
+ final actionTypes = _buildActionTypes();
+ final menuItems = <Widget>[];
+
+ for (final actionType in actionTypes) {
+ if (actionType == ViewMoreActionType.divider) {
+ if (menuItems.isNotEmpty) {
+ menuItems.add(const AFDivider(spacing: 4));
+ }
+ } else {
+ menuItems.add(
+ AFTextMenuItem(
+ leading: FlowySvg(
+ actionType.leftIconSvg,
+ size: const Size.square(16),
+ color: actionType == ViewMoreActionType.delete
+ ? Theme.of(context).colorScheme.error
+ : null,
+ ),
+ title: actionType.name,
+ titleColor: actionType == ViewMoreActionType.delete
+ ? Theme.of(context).colorScheme.error
+ : null,
+ trailing: actionType.rightIcon,
+ onTap: () {
+ widget.onAction(actionType, widget.view, null);
+ controller.hide();
+ },
+ ),
+ );
+ }
+ }
+
+ return menuItems;
+ }
+
+ List<ViewMoreActionType> _buildActionTypes() {
+ final List<ViewMoreActionType> actionTypes = [];
+
+ // Always allow add to favorites and open in new tab
+ actionTypes.add(
+ widget.view.isFavorite
+ ? ViewMoreActionType.unFavorite
+ : ViewMoreActionType.favorite,
+ );
+
+ // Only show editable actions if access level allows it
+ if (widget.accessLevel != ShareAccessLevel.readOnly) {
+ actionTypes.addAll([
+ ViewMoreActionType.divider,
+ ViewMoreActionType.rename,
+ ]);
+
+ // Chat doesn't change icon and duplicate
+ if (widget.view.layout != ViewLayoutPB.Chat) {
+ actionTypes.addAll([
+ ViewMoreActionType.changeIcon,
+ ]);
+ }
+
+ if (widget.accessLevel == ShareAccessLevel.fullAccess) {
+ actionTypes.addAll([
+ ViewMoreActionType.delete,
+ ]);
+ }
+ }
+
+ actionTypes.add(ViewMoreActionType.divider);
+ actionTypes.add(ViewMoreActionType.openInNewTab);
+
+ return actionTypes;
+ }
+}
diff --git a/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_pages_list.dart b/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_pages_list.dart
index 5203fb6229..0143e8a856 100644
--- a/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_pages_list.dart
+++ b/frontend/appflowy_flutter/lib/features/shared_section/presentation/widgets/shared_pages_list.dart
@@ -1,19 +1,29 @@
+import 'package:appflowy/features/share_tab/data/models/share_access_level.dart';
import 'package:appflowy/features/shared_section/models/shared_page.dart';
+import 'package:appflowy/features/shared_section/presentation/widgets/shared_page_actions_button.dart';
+import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart';
-import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart';
import 'package:appflowy/workspace/presentation/home/home_sizes.dart';
import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
class SharedPagesList extends StatelessWidget {
const SharedPagesList({
super.key,
required this.sharedPages,
+ required this.onAction,
+ required this.onSelected,
+ required this.onTertiarySelected,
+ required this.onSetEditing,
});
final SharedPages sharedPages;
+ final ViewItemOnSelected onSelected;
+ final ViewItemOnSelected onTertiarySelected;
+ final SharedPageActionsButtonCallback onAction;
+ final SharedPageActionsButtonSetEditingCallback onSetEditing;
@override
Widget build(BuildContext context) {
@@ -21,6 +31,7 @@ class SharedPagesList extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: sharedPages.map((sharedPage) {
final view = sharedPage.view;
+ final accessLevel = sharedPage.accessLevel;
return ViewItem(
key: ValueKey(view.id),
spaceType: FolderSpaceType.public,
@@ -30,16 +41,41 @@ class SharedPagesList extends StatelessWidget {
isDraggable: false, // disable draggable for shared pages
leftPadding: HomeSpaceViewSizes.leftPadding,
isFeedback: false,
- onSelected: (context, view) {
- if (HardwareKeyboard.instance.isControlPressed) {
- context.read<TabsBloc>().openTab(view);
- }
- context.read<TabsBloc>().openPlugin(view);
- },
- onTertiarySelected: (context, view) =>
- context.read<TabsBloc>().openTab(view),
+ onSelected: onSelected,
+ onTertiarySelected: onTertiarySelected,
+ rightIconsBuilder: (context, view) => [
+ IntrinsicWidth(
+ child: _buildSharedPageMoreActionButton(
+ context,
+ view,
+ accessLevel,
+ ),
+ ),
+ const SizedBox(width: 4.0),
+ ],
);
}).toList(),
);
}
+
+ Widget _buildSharedPageMoreActionButton(
+ BuildContext context,
+ ViewPB view,
+ ShareAccessLevel accessLevel,
+ ) {
+ return SharedPageActionsButton(
+ view: view,
+ accessLevel: accessLevel,
+ onAction: onAction,
+ onSetEditing: onSetEditing,
+ buildChild: (controller) => FlowyIconButton(
+ width: 24,
+ icon: const FlowySvg(FlowySvgs.workspace_three_dots_s),
+ onPressed: () {
+ onSetEditing(context, true);
+ controller.show();
+ },
+ ),
+ );
+ }
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
index 7ac15e9a54..3733499c10 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
@@ -239,11 +239,15 @@ class _HomeHotKeysState extends State<HomeHotKeys> {
Future<void> _scaleWithStep(double step) async {
final currentScaleFactor = await windowSizeManager.getScaleFactor();
- final textScale = (currentScaleFactor + step).clamp(
+
+ double textScale = (currentScaleFactor + step).clamp(
WindowSizeManager.minScaleFactor,
WindowSizeManager.maxScaleFactor,
);
+ // only keep 2 decimal places
+ textScale = double.parse(textScale.toStringAsFixed(2));
+
Log.info('scale the app from $currentScaleFactor to $textScale');
await _scale(textScale);
@@ -254,7 +258,7 @@ class _HomeHotKeysState extends State<HomeHotKeys> {
// The integration test will fail if we check the scale factor in the test.
// #0 ScaledWidgetsFlutterBinding.Eval ()
// #1 ScaledWidgetsFlutterBinding.instance (package:scaled_app/scaled_app.dart:66:62)
- appflowyScaleFactor = scaleFactor;
+ appflowyScaleFactor = double.parse(scaleFactor.toStringAsFixed(2));
} else {
ScaledWidgetsFlutterBinding.instance.scaleFactor = (_) => scaleFactor;
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart
index 2970aa9c93..23d8ba7866 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart
@@ -63,13 +63,6 @@ class SidebarSpace extends StatelessWidget {
},
),
- // spaces
- if (shouldShowSpaces) ...[
- const VSpace(16.0),
- // spaces
- const _Space(),
- ],
-
// shared
if (FeatureFlag.sharedSection.isOn) ...[
const VSpace(16.0),
@@ -79,6 +72,13 @@ class SidebarSpace extends StatelessWidget {
),
],
+ // spaces
+ if (shouldShowSpaces) ...[
+ const VSpace(16.0),
+ // spaces
+ const _Space(),
+ ],
+
const VSpace(200),
],
),
diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml
index 3475822354..2b8f7dfac9 100644
--- a/frontend/appflowy_flutter/pubspec.yaml
+++ b/frontend/appflowy_flutter/pubspec.yaml
@@ -4,7 +4,7 @@ description: Bring projects, wikis, and teams together with AI. AppFlowy is an
your data. The best open source alternative to Notion.
publish_to: "none"
-version: 0.9.3
+version: 0.9.4
environment:
flutter: ">=3.27.4"
diff --git a/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_page_actions_button_test.dart b/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_page_actions_button_test.dart
new file mode 100644
index 0000000000..4f381eb99f
--- /dev/null
+++ b/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_page_actions_button_test.dart
@@ -0,0 +1,269 @@
+import 'package:appflowy/core/config/kv.dart';
+import 'package:appflowy/features/share_tab/data/models/share_access_level.dart';
+import 'package:appflowy/features/shared_section/presentation/widgets/shared_page_actions_button.dart';
+import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';
+import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:appflowy_ui/appflowy_ui.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:get_it/get_it.dart';
+import 'package:mocktail/mocktail.dart';
+
+import '../../../widget_test_wrapper.dart';
+
+void main() {
+ setUp(() {
+ final mockStorage = MockKeyValueStorage();
+ // Stub methods to return appropriate Future values
+ when(() => mockStorage.get(any())).thenAnswer((_) => Future.value());
+ when(() => mockStorage.set(any(), any())).thenAnswer((_) => Future.value());
+ when(() => mockStorage.remove(any())).thenAnswer((_) => Future.value());
+ when(() => mockStorage.clear()).thenAnswer((_) => Future.value());
+
+ GetIt.I.registerSingleton<KeyValueStorage>(mockStorage);
+ GetIt.I.registerSingleton<MenuSharedState>(MenuSharedState());
+ });
+
+ tearDown(() {
+ GetIt.I.reset();
+ });
+
+ group('SharedPageActionsButton: ', () {
+ late ViewPB testView;
+ late List<ViewMoreActionType> capturedActions;
+ late List<bool> capturedEditingStates;
+
+ setUp(() {
+ testView = ViewPB()
+ ..id = 'test_view_id'
+ ..name = 'Test View'
+ ..layout = ViewLayoutPB.Document
+ ..isFavorite = false;
+ capturedActions = [];
+ capturedEditingStates = [];
+ });
+
+ Widget buildTestWidget({
+ required ShareAccessLevel accessLevel,
+ ViewPB? view,
+ }) {
+ return WidgetTestWrapper(
+ child: Scaffold(
+ body: SharedPageActionsButton(
+ view: view ?? testView,
+ accessLevel: accessLevel,
+ onAction: (type, view, data) {
+ capturedActions.add(type);
+ },
+ onSetEditing: (context, value) {
+ capturedEditingStates.add(value);
+ },
+ buildChild: (controller) => ElevatedButton(
+ onPressed: () => controller.show(),
+ child: const Text('Actions'),
+ ),
+ ),
+ ),
+ );
+ }
+
+ testWidgets('renders action button correctly', (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.readOnly),
+ );
+
+ expect(find.text('Actions'), findsOneWidget);
+ expect(find.byType(SharedPageActionsButton), findsOneWidget);
+ });
+
+ testWidgets('shows popover when button is tapped',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.readOnly),
+ );
+
+ // Tap the button to show popover
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Should show the AFMenu popover
+ expect(find.byType(AFMenu), findsOneWidget);
+ });
+
+ testWidgets('shows correct menu items for read-only access',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.readOnly),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // For read-only access, should only show favorite and open in new tab
+ expect(find.byType(AFTextMenuItem), findsNWidgets(2));
+
+ // Should find favorite action (since view is not favorited)
+ expect(find.text(ViewMoreActionType.favorite.name), findsOneWidget);
+
+ // Should find open in new tab action
+ expect(find.text(ViewMoreActionType.openInNewTab.name), findsOneWidget);
+
+ // Should NOT find editable actions
+ expect(find.text(ViewMoreActionType.rename.name), findsNothing);
+ expect(find.text(ViewMoreActionType.delete.name), findsNothing);
+ });
+
+ testWidgets('shows correct menu items for edit access',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.readAndWrite),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Should show favorite, rename, change icon, and open in new tab
+ expect(find.text(ViewMoreActionType.favorite.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.rename.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.changeIcon.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.openInNewTab.name), findsOneWidget);
+
+ // Should NOT show delete for edit access
+ expect(find.text(ViewMoreActionType.delete.name), findsNothing);
+ });
+
+ testWidgets('shows correct menu items for full access',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.fullAccess),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Should show all actions including delete
+ expect(find.text(ViewMoreActionType.favorite.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.rename.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.changeIcon.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.delete.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.openInNewTab.name), findsOneWidget);
+ });
+
+ testWidgets('shows unfavorite when view is favorited',
+ (WidgetTester tester) async {
+ final favoritedView = ViewPB()
+ ..id = 'test_view_id'
+ ..name = 'Test View'
+ ..layout = ViewLayoutPB.Document
+ ..isFavorite = true;
+
+ await tester.pumpWidget(
+ buildTestWidget(
+ accessLevel: ShareAccessLevel.readOnly,
+ view: favoritedView,
+ ),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ expect(find.text(ViewMoreActionType.unFavorite.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.favorite.name), findsNothing);
+ });
+
+ testWidgets('does not show change icon for chat layout',
+ (WidgetTester tester) async {
+ final chatView = ViewPB()
+ ..id = 'test_view_id'
+ ..name = 'Test Chat'
+ ..layout = ViewLayoutPB.Chat
+ ..isFavorite = false;
+
+ await tester.pumpWidget(
+ buildTestWidget(
+ accessLevel: ShareAccessLevel.readAndWrite,
+ view: chatView,
+ ),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Should show rename but not change icon for chat
+ expect(find.text(ViewMoreActionType.rename.name), findsOneWidget);
+ expect(find.text(ViewMoreActionType.changeIcon.name), findsNothing);
+ });
+
+ testWidgets('triggers onAction callback when menu item is tapped',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.fullAccess),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Tap on the favorite action
+ await tester.tap(find.text(ViewMoreActionType.favorite.name));
+ await tester.pumpAndSettle();
+
+ expect(capturedActions, contains(ViewMoreActionType.favorite));
+ });
+
+ testWidgets('shows dividers between action groups',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.fullAccess),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Should have dividers separating action groups
+ expect(find.byType(AFDivider), findsAtLeastNWidgets(1));
+ });
+
+ testWidgets('delete action shows error color', (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.fullAccess),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Find the delete menu item
+ final deleteMenuItem = find.ancestor(
+ of: find.text(ViewMoreActionType.delete.name),
+ matching: find.byType(AFTextMenuItem),
+ );
+
+ expect(deleteMenuItem, findsOneWidget);
+
+ // The delete action should be present
+ expect(find.text(ViewMoreActionType.delete.name), findsOneWidget);
+ });
+
+ testWidgets('popover hides when menu item is selected',
+ (WidgetTester tester) async {
+ await tester.pumpWidget(
+ buildTestWidget(accessLevel: ShareAccessLevel.readOnly),
+ );
+
+ await tester.tap(find.text('Actions'));
+ await tester.pumpAndSettle();
+
+ // Popover should be visible
+ expect(find.byType(AFMenu), findsOneWidget);
+
+ // Tap on favorite action
+ await tester.tap(find.text(ViewMoreActionType.favorite.name));
+ await tester.pumpAndSettle();
+
+ // Popover should be hidden
+ expect(find.byType(AFMenu), findsNothing);
+ });
+ });
+}
+
+class MockKeyValueStorage extends Mock implements KeyValueStorage {}
diff --git a/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_pages_list_test.dart b/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_pages_list_test.dart
index dce47fa082..7868bf80e1 100644
--- a/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_pages_list_test.dart
+++ b/frontend/appflowy_flutter/test/widget_test/lib/features/share_section/shared_pages_list_test.dart
@@ -47,7 +47,13 @@ void main() {
await tester.pumpWidget(
WidgetTestWrapper(
child: SingleChildScrollView(
- child: SharedPagesList(sharedPages: sharedPages),
+ child: SharedPagesList(
+ sharedPages: sharedPages,
+ onAction: (action, view, data) {},
+ onSelected: (context, view) {},
+ onTertiarySelected: (context, view) {},
+ onSetEditing: (context, value) {},
+ ),
),
),
);
diff --git a/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/access_level_list_widget_test.dart b/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/access_level_list_widget_test.dart
index 495983547b..937b6709b4 100644
--- a/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/access_level_list_widget_test.dart
+++ b/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/access_level_list_widget_test.dart
@@ -19,8 +19,8 @@ void main() {
await tester.pumpWidget(
WidgetTestWrapper(
child: AccessLevelListWidget(
- enableAccessLevelSelection: true,
selectedAccessLevel: ShareAccessLevel.readAndWrite,
+ supportedAccessLevels: ShareAccessLevel.values,
callbacks: AccessLevelListCallbacks(
onSelectAccessLevel: (level) => selectedLevel = level,
onTurnIntoMember: () => turnedIntoMember = true,
@@ -58,30 +58,5 @@ void main() {
await tester.pumpAndSettle();
expect(removedAccess, isTrue);
});
-
- testWidgets('shows only management options when selection disabled',
- (WidgetTester tester) async {
- await tester.pumpWidget(
- WidgetTestWrapper(
- child: AccessLevelListWidget(
- selectedAccessLevel: ShareAccessLevel.readOnly,
- callbacks: AccessLevelListCallbacks.none(),
- ),
- ),
- );
-
- // Access level options should not be found
- expect(find.text(ShareAccessLevel.fullAccess.i18n), findsNothing);
- expect(find.text(ShareAccessLevel.readAndWrite.i18n), findsNothing);
- expect(find.text(ShareAccessLevel.readAndComment.i18n), findsNothing);
- expect(find.text(ShareAccessLevel.readOnly.i18n), findsNothing);
-
- // Management options should be present
- expect(
- find.text(LocaleKeys.shareTab_turnIntoMember.tr()),
- findsOneWidget,
- );
- expect(find.text(LocaleKeys.shareTab_removeAccess.tr()), findsOneWidget);
- });
});
}
diff --git a/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/edit_access_level_widget_test.dart b/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/edit_access_level_widget_test.dart
index dcaec14f6d..05bd144774 100644
--- a/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/edit_access_level_widget_test.dart
+++ b/frontend/appflowy_flutter/test/widget_test/lib/features/share_tab/edit_access_level_widget_test.dart
@@ -13,6 +13,7 @@ void main() {
WidgetTestWrapper(
child: EditAccessLevelWidget(
selectedAccessLevel: ShareAccessLevel.readOnly,
+ supportedAccessLevels: ShareAccessLevel.values,
callbacks: AccessLevelListCallbacks(
onSelectAccessLevel: (level) {},
onTurnIntoMember: () {},
diff --git a/frontend/resources/translations/en-US.json b/frontend/resources/translations/en-US.json
index 86a1886797..c72c710853 100644
--- a/frontend/resources/translations/en-US.json
+++ b/frontend/resources/translations/en-US.json
@@ -3433,7 +3433,7 @@
"guest": "Guest"
},
"shareSection": {
- "shared": "Shared",
+ "shared": "Shared with me",
"refresh": "Refresh"
}
}
\ No newline at end of file
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 22ed2ffc14..b6be35fcd3 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -163,7 +163,7 @@ checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"bincode",
@@ -183,7 +183,7 @@ dependencies = [
[[package]]
name = "appflowy-ai-client"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"bytes",
@@ -860,7 +860,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"again",
"anyhow",
@@ -915,7 +915,7 @@ dependencies = [
[[package]]
name = "client-api-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"collab-entity",
"collab-rt-entity",
@@ -928,7 +928,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"futures-channel",
"futures-util",
@@ -1199,7 +1199,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"bincode",
@@ -1221,7 +1221,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"async-trait",
@@ -1648,7 +1648,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"bincode",
"bytes",
@@ -3191,7 +3191,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"getrandom 0.2.10",
@@ -3206,7 +3206,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"app-error",
"jsonwebtoken",
@@ -3899,7 +3899,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"bytes",
@@ -6870,7 +6870,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"app-error",
@@ -8925,7 +8925,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ae3c4fa#ae3c4fa03f182b05d29794df3bbd540322987067"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=592f644#592f644a24beb159d45f25a4cabc34621ef7382c"
dependencies = [
"anyhow",
"async-trait",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index 6b4893b1d8..3835319328 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -110,9 +110,9 @@ flowy-sqlite-vec = { path = "flowy-sqlite-vec" }
# Run the script.add_workspace_members:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ae3c4fa" }
-client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ae3c4fa" }
-workspace-template = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ae3c4fa" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "592f644" }
+client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "592f644" }
+workspace-template = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "592f644" }
[profile.dev]
opt-level = 0
diff --git a/frontend/rust-lib/flowy-error/src/code.rs b/frontend/rust-lib/flowy-error/src/code.rs
index da978218df..27e9a73dbd 100644
--- a/frontend/rust-lib/flowy-error/src/code.rs
+++ b/frontend/rust-lib/flowy-error/src/code.rs
@@ -401,6 +401,15 @@ pub enum ErrorCode {
#[error("New password is too short")]
NewPasswordTooShort = 137,
+
+ #[error("Guest limit exceeded for free plan")]
+ FreePlanGuestLimitExceeded = 138,
+
+ #[error("Guest limit exceeded for paid plan")]
+ PaidPlanGuestLimitExceeded = 139,
+
+ #[error("Invalid guest")]
+ InvalidGuest = 140,
}
impl ErrorCode {
diff --git a/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs b/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
index 53617c8c36..ab3f97486b 100644
--- a/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
+++ b/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
@@ -40,6 +40,9 @@ impl From<AppResponseError> for FlowyError {
AppErrorCode::PublishNameTooLong => ErrorCode::PublishNameTooLong,
AppErrorCode::CustomNamespaceInvalidCharacter => ErrorCode::CustomNamespaceInvalidCharacter,
AppErrorCode::AIServiceUnavailable => ErrorCode::AIServiceUnavailable,
+ AppErrorCode::FreePlanGuestLimitExceeded => ErrorCode::FreePlanGuestLimitExceeded,
+ AppErrorCode::InvalidGuest => ErrorCode::InvalidGuest,
+ AppErrorCode::PaidPlanGuestLimitExceeded => ErrorCode::PaidPlanGuestLimitExceeded,
_ => ErrorCode::Internal,
};