From 230756d24251c50e96a638b13418c1644f0f233b Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Wed, 15 Mar 2023 15:47:29 +0800 Subject: [PATCH 1/5] fix: #1928 network cover doesn't work (#1996) --- .../cover/cover_image_picker_bloc.dart | 96 ++++++++++--------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/cover/cover_image_picker_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/cover/cover_image_picker_bloc.dart index 2389b3681c..70651da937 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/cover/cover_image_picker_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/cover/cover_image_picker_bloc.dart @@ -12,13 +12,15 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:dartz/dartz.dart'; import 'package:http/http.dart' as http; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:path/path.dart' as path; +import 'package:path/path.dart' as p; import 'change_cover_popover.dart'; part 'cover_image_picker_bloc.freezed.dart'; class CoverImagePickerBloc extends Bloc { + static const allowedExtensions = ['jpg', 'png', 'jpeg']; + CoverImagePickerBloc() : super(const CoverImagePickerState.initial()) { on( (event, emit) async { @@ -28,7 +30,7 @@ class CoverImagePickerBloc }, urlSubmit: (UrlSubmit urlSubmit) async { emit(const CoverImagePickerState.loading()); - final validateImage = await _validateUrl(urlSubmit.path); + final validateImage = await _validateURL(urlSubmit.path); if (validateImage) { emit(CoverImagePickerState.networkImage(left(urlSubmit.path))); } else { @@ -86,28 +88,22 @@ class CoverImagePickerBloc if (state is FileImagePicked) { try { final path = state.path; - final newPath = '$directory/${path.split("\\").last}'; + final newPath = p.join(directory, p.split(path).last); final newFile = await File(path).copy(newPath); imagePaths.add(newFile.path); - await prefs.setStringList(kLocalImagesKey, imagePaths); - return imagePaths; } catch (e) { return null; } } else if (state is NetworkImagePicked) { try { - String? url = state.successOrFail.fold((path) => path, (r) => null); + final url = state.successOrFail.fold((path) => path, (r) => null); if (url != null) { final response = await http.get(Uri.parse(url)); - final newPath = - "$directory/IMG_$_timeStampString.${_getExtention(url)}"; - + final newPath = p.join(directory, _networkImageName(url)); final imageFile = File(newPath); await imageFile.create(); await imageFile.writeAsBytes(response.bodyBytes); imagePaths.add(imageFile.absolute.path); - await prefs.setStringList(kLocalImagesKey, imagePaths); - return imagePaths; } else { return null; } @@ -115,59 +111,71 @@ class CoverImagePickerBloc return null; } } + await prefs.setStringList(kLocalImagesKey, imagePaths); + return imagePaths; } - _pickImages() async { - FilePickerResult? result = await getIt().pickFiles( + Future _pickImages() async { + final result = await getIt().pickFiles( dialogTitle: LocaleKeys.document_plugins_cover_addLocalImage.tr(), allowMultiple: false, type: fp.FileType.image, - allowedExtensions: ['jpg', 'png', 'jpeg'], + allowedExtensions: allowedExtensions, ); if (result != null && result.files.isNotEmpty) { - final path = result.files.first.path; - if (path != null) { - return path; - } else { - return null; - } + return result.files.first.path; } return null; } Future _coverPath() async { final directory = await getIt().fetchLocation(); - return Directory(path.join(directory, 'covers')) + return Directory(p.join(directory, 'covers')) .create(recursive: true) .then((value) => value.path); } - String get _timeStampString => - DateTime.now().millisecondsSinceEpoch.toString(); + String _networkImageName(String url) { + return 'IMG_${DateTime.now().millisecondsSinceEpoch.toString()}.${_getExtention( + url, + fromNetwork: true, + )}'; + } - String? _getExtention(String path) => path.contains(".jpg") - ? "jpg" - : path.contains(".png") - ? "png" - : path.contains(".jpeg") - ? "jpeg" - : (path.contains("auto=format") && path.contains("unsplash")) - ? "jpeg" - : null; - - _validateUrl(String path) async { - if (_getExtention(path) != null) { - try { - final response = await http.get(Uri.parse(path)); - if (response.statusCode == 200) { - return true; - } else { - return false; - } - } catch (e) { - return false; + String? _getExtention( + String path, { + bool fromNetwork = false, + }) { + String? ext; + if (!fromNetwork) { + final extension = p.extension(path); + if (extension.isEmpty) { + return null; } + ext = extension.substring(1); } else { + final uri = Uri.parse(path); + final paramters = uri.queryParameters; + final dl = paramters['dl']; + if (dl != null) { + ext = p.extension(dl).substring(1); + } + } + if (allowedExtensions.contains(ext)) { + return ext; + } + return null; + } + + Future _validateURL(String path) async { + final extension = _getExtention(path, fromNetwork: true); + if (extension == null) { + return false; + } + try { + final response = await http.head(Uri.parse(path)); + return response.statusCode == 200; + } catch (e) { return false; } } From caffb9fdcfca0d86c2c7885f93d73f32de1d155a Mon Sep 17 00:00:00 2001 From: Aman Negi <37607224+AmanNegi@users.noreply.github.com> Date: Thu, 16 Mar 2023 07:11:14 +0530 Subject: [PATCH 2/5] fix(appflowy_flutter): Flutter Version Reset Error (#1923) * fix(appflowy_flutter): Version Reset Error - `flutter channel stable` was causing the FlutterSDK to upgrade to it's latest version. - Added code to fix this behaviour. - Tested on Windows and Linux. * fix(app_flowy): Error in MacOS script - Replace `-P` with `-E` which should now work as expected in Mac devices. * fix(app_flowy): Commit Structure - Fixed Commit Structure * fix: path reset Now we move back to cwd after making changes * chore: change to LF from CTLF --------- Co-authored-by: Lucas.Xu --- .../scripts/install_dev_env/install_linux.sh | 51 ++++++++++++------- .../scripts/install_dev_env/install_macos.sh | 34 ++++++++++--- .../install_dev_env/install_windows.sh | 27 ++++++++-- 3 files changed, 82 insertions(+), 30 deletions(-) diff --git a/frontend/scripts/install_dev_env/install_linux.sh b/frontend/scripts/install_dev_env/install_linux.sh index f414897550..bb1b3fd775 100755 --- a/frontend/scripts/install_dev_env/install_linux.sh +++ b/frontend/scripts/install_dev_env/install_linux.sh @@ -6,39 +6,56 @@ RED="\e[31m" ENDCOLOR="\e[0m" printMessage() { - printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n" + printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n" } printSuccess() { - printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n" + printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n" } printError() { - printf "${RED}AppFlowy : $1${ENDCOLOR}\n" + printf "${RED}AppFlowy : $1${ENDCOLOR}\n" } - # Note: This script does not install applications which are installed by the package manager. There are too many package managers out there. -# Install Rust +# Install Rust printMessage "The Rust programming language is required to compile AppFlowy." printMessage "We can install it now if you don't already have it on your system." read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust if [ ${installrust^^} == "Y" ]; then - printMessage "Installing Rust." - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - source $HOME/.cargo/env - rustup toolchain install stable - rustup default stable + printMessage "Installing Rust." + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source $HOME/.cargo/env + rustup toolchain install stable + rustup default stable else - printMessage "Skipping Rust installation." + printMessage "Skipping Rust installation." fi -# Enable the flutter stable channel printMessage "Setting up Flutter" -flutter channel stable +# Get the current Flutter version +FLUTTER_VERSION=$(flutter --version | grep -oP 'Flutter \K\S+') +# Check if the current version is 3.3.10 +if [ "$FLUTTER_VERSION" = "3.3.10" ]; then + echo "Flutter version is already 3.3.10" +else + # Get the path to the Flutter SDK + FLUTTER_PATH=$(which flutter) + FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter} + + current_dir=$(pwd) + + cd $FLUTTER_PATH + # Use git to checkout version 3.3.10 of Flutter + git checkout 3.3.10 + # Get back to current working directory + cd "$current_dir" + + echo "Switched to Flutter version 3.3.10" +fi # Enable linux desktop flutter config --enable-linux-desktop @@ -47,9 +64,9 @@ flutter config --enable-linux-desktop flutter doctor printMessage "Installing keybinder-3.0" -if command apt-get &> /dev/null; then +if command apt-get &>/dev/null; then sudo apt-get install keybinder-3.0-dev -elif command dnf &> /dev/null; then +elif command dnf &>/dev/null; then sudo dnf install keybinder3-devel else echo 'Your system is not supported, please install keybinder3 manually.' @@ -59,11 +76,11 @@ fi printMessage "Setting up githooks." git config core.hooksPath .githooks -# Install go-gitlint +# Install go-gitlint printMessage "Installing go-gitlint." GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz" wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint +tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint rm ${GOLINT_FILENAME} # Change to the frontend directory diff --git a/frontend/scripts/install_dev_env/install_macos.sh b/frontend/scripts/install_dev_env/install_macos.sh index 70333677ef..0efb416d6f 100755 --- a/frontend/scripts/install_dev_env/install_macos.sh +++ b/frontend/scripts/install_dev_env/install_macos.sh @@ -17,8 +17,7 @@ printError() { printf "${RED}AppFlowy : $1${ENDCOLOR}\n" } - -# Install Rust +# Install Rust printMessage "The Rust programming language is required to compile AppFlowy." printMessage "We can install it now if you don't already have it on your system." @@ -28,7 +27,7 @@ if [[ "${installrust:-N}" == [Yy] ]]; then printMessage "Installing Rust." brew install rustup-init rustup-init -y --default-toolchain=stable - + source "$HOME/.cargo/env" else printMessage "Skipping Rust installation." @@ -36,11 +35,30 @@ fi # Install sqllite printMessage "Installing sqlLite3." -brew install sqlite3 +brew install sqlite3 -# Enable the flutter stable channel printMessage "Setting up Flutter" -flutter channel stable + +# Get the current Flutter version +FLUTTER_VERSION=$(flutter --version | grep -oE 'Flutter [^ ]+' | grep -oE '[^ ]+$') +# Check if the current version is 3.3.10 +if [ "$FLUTTER_VERSION" = "3.3.10" ]; then + echo "Flutter version is already 3.3.10" +else + # Get the path to the Flutter SDK + FLUTTER_PATH=$(which flutter) + FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter} + + current_dir=$(pwd) + + cd $FLUTTER_PATH + # Use git to checkout version 3.3.10 of Flutter + git checkout 3.3.10 + # Get back to current working directory + cd "$current_dir" + + echo "Switched to Flutter version 3.3.10" +fi # Enable linux desktop flutter config --enable-macos-desktop @@ -52,11 +70,11 @@ flutter doctor printMessage "Setting up githooks." git config core.hooksPath .githooks -# Install go-gitlint +# Install go-gitlint printMessage "Installing go-gitlint." GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz" curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME} -tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint +tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint rm ${GOLINT_FILENAME} # Change to the frontend directory diff --git a/frontend/scripts/install_dev_env/install_windows.sh b/frontend/scripts/install_dev_env/install_windows.sh index 5d51b2e28f..e29f574350 100644 --- a/frontend/scripts/install_dev_env/install_windows.sh +++ b/frontend/scripts/install_dev_env/install_windows.sh @@ -17,7 +17,6 @@ printError() { printf "${RED}AppFlowy : $1${ENDCOLOR}\n" } - # Note: This script does not install applications which are installed by the package manager. There are too many package managers out there. # Install Rust @@ -46,9 +45,27 @@ else printSuccess "Rust has been detected on your system, so Rust installation has been skipped" fi -# Enable the flutter stable channel printMessage "Setting up Flutter" -flutter channel stable +# Get the current Flutter version +FLUTTER_VERSION=$(flutter --version | grep -oP 'Flutter \K\S+') +# Check if the current version is 3.3.10 +if [ "$FLUTTER_VERSION" = "3.3.10" ]; then + echo "Flutter version is already 3.3.10" +else + # Get the path to the Flutter SDK + FLUTTER_PATH=$(which flutter) + FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter} + + current_dir=$(pwd) + + cd $FLUTTER_PATH + # Use git to checkout version 3.3.10 of Flutter + git checkout 3.3.10 + # Get back to current working directory + cd "$current_dir" + + echo "Switched to Flutter version 3.3.10" +fi # Add pub cache and cargo to PATH powershell '[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $Env:LOCALAPPDATA + "\Pub\Cache\Bin", [EnvironmentVariableTarget]::User)' @@ -64,14 +81,14 @@ flutter doctor printMessage "Setting up githooks." git config core.hooksPath .githooks -# Install go-gitlint +# Install go-gitlint printMessage "Installing go-gitlint." GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz" if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint.exe rm ${GOLINT_FILENAME} else - printError "Failed to install go-gitlint" + printError "Failed to install go-gitlint" fi # Change to the frontend directory From 888c7977eb6c6a47c67fa8aff600dd8f1c58720d Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Thu, 16 Mar 2023 17:16:15 +0800 Subject: [PATCH 3/5] fix: paser workspce pb (#2005) --- .../lib/user/application/user_listener.dart | 11 +++--- .../src/services/workspace/controller.rs | 34 ++++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/frontend/appflowy_flutter/lib/user/application/user_listener.dart b/frontend/appflowy_flutter/lib/user/application/user_listener.dart index 595669bda9..8dc182a48b 100644 --- a/frontend/appflowy_flutter/lib/user/application/user_listener.dart +++ b/frontend/appflowy_flutter/lib/user/application/user_listener.dart @@ -83,11 +83,10 @@ class UserWorkspaceListener { PublishNotifier(); FolderNotificationListener? _listener; - final UserProfilePB _userProfile; UserWorkspaceListener({ required UserProfilePB userProfile, - }) : _userProfile = userProfile; + }); void start({ void Function(AuthNotifyValue)? onAuthChanged, @@ -106,14 +105,18 @@ class UserWorkspaceListener { _settingChangedNotifier?.addPublishListener(onSettingUpdated); } + // The "current-workspace" is predefined in the backend. Do not try to + // modify it _listener = FolderNotificationListener( - objectId: _userProfile.token, + objectId: "current-workspace", handler: _handleObservableType, ); } void _handleObservableType( - FolderNotification ty, Either result) { + FolderNotification ty, + Either result, + ) { switch (ty) { case FolderNotification.DidCreateWorkspace: case FolderNotification.DidDeleteWorkspace: diff --git a/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs b/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs index ad704f2650..733adfb349 100644 --- a/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs @@ -11,6 +11,7 @@ use crate::{ }; use flowy_sqlite::kv::KV; use folder_model::{AppRevision, WorkspaceRevision}; +use lib_dispatch::prelude::ToBytes; use std::sync::Arc; pub struct WorkspaceController { @@ -41,7 +42,6 @@ impl WorkspaceController { ) -> Result { let workspace = self.create_workspace_on_server(params.clone()).await?; let user_id = self.user.user_id()?; - let token = self.user.token()?; let workspaces = self .persistence .begin_transaction(|transaction| { @@ -53,9 +53,7 @@ impl WorkspaceController { .map(|workspace_rev| workspace_rev.into()) .collect(); let repeated_workspace = RepeatedWorkspacePB { items: workspaces }; - send_notification(&token, FolderNotification::DidCreateWorkspace) - .payload(repeated_workspace) - .send(); + send_workspace_notification(FolderNotification::DidCreateWorkspace, repeated_workspace); set_current_workspace(&user_id, &workspace.id); Ok(workspace) } @@ -76,9 +74,7 @@ impl WorkspaceController { }) .await?; - send_notification(&workspace_id, FolderNotification::DidUpdateWorkspace) - .payload(workspace) - .send(); + send_workspace_notification(FolderNotification::DidUpdateWorkspace, workspace); self.update_workspace_on_server(params)?; Ok(()) @@ -87,7 +83,6 @@ impl WorkspaceController { #[allow(dead_code)] pub(crate) async fn delete_workspace(&self, workspace_id: &str) -> Result<(), FlowyError> { let user_id = self.user.user_id()?; - let token = self.user.token()?; let repeated_workspace = self .persistence .begin_transaction(|transaction| { @@ -95,9 +90,8 @@ impl WorkspaceController { self.read_workspaces(None, &user_id, &transaction) }) .await?; - send_notification(&token, FolderNotification::DidDeleteWorkspace) - .payload(repeated_workspace) - .send(); + + send_workspace_notification(FolderNotification::DidDeleteWorkspace, repeated_workspace); self.delete_workspace_on_server(workspace_id)?; Ok(()) } @@ -224,7 +218,6 @@ pub async fn notify_workspace_setting_did_change( view_id: &str, ) -> FlowyResult<()> { let user_id = folder_manager.user.user_id()?; - let token = folder_manager.user.token()?; let workspace_id = get_current_workspace(&user_id)?; let workspace_setting = folder_manager @@ -250,13 +243,22 @@ pub async fn notify_workspace_setting_did_change( Ok(setting) }) .await?; - - send_notification(&token, FolderNotification::DidUpdateWorkspaceSetting) - .payload(workspace_setting) - .send(); + send_workspace_notification( + FolderNotification::DidUpdateWorkspaceSetting, + workspace_setting, + ); Ok(()) } +/// The [CURRENT_WORKSPACE] represents as the current workspace that opened by the +/// user. Only one workspace can be opened at a time. +const CURRENT_WORKSPACE: &str = "current-workspace"; +fn send_workspace_notification(ty: FolderNotification, payload: T) { + send_notification(CURRENT_WORKSPACE, ty) + .payload(payload) + .send(); +} + const CURRENT_WORKSPACE_ID: &str = "current_workspace_id"; pub fn set_current_workspace(_user_id: &str, workspace_id: &str) { From 0630dc10b706abf049c4c5f3757d2bf962cbafad Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:35:11 +0800 Subject: [PATCH 4/5] chore: popover offsets (#1960) --- .../presentation/toolbar/board_toolbar.dart | 1 + .../header/field_type_option_editor.dart | 2 +- .../widgets/header/type_option/date.dart | 4 +-- .../widgets/header/type_option/number.dart | 2 +- .../header/type_option/select_option.dart | 2 +- .../widgets/sort/sort_editor.dart | 2 +- .../widgets/toolbar/filter_button.dart | 33 +++++++++-------- .../widgets/toolbar/grid_property.dart | 2 +- .../widgets/toolbar/setting_button.dart | 35 ++++++++++--------- .../widgets/toolbar/sort_button.dart | 2 +- .../checklist_cell/checklist_cell_editor.dart | 2 +- .../row/cells/date_cell/date_editor.dart | 6 ++-- .../select_option_editor.dart | 2 +- .../widgets/row/cells/url_cell/url_cell.dart | 4 +-- .../presentation/share/share_button.dart | 1 + .../home/menu/app/header/add_button.dart | 1 + .../widgets/float_bubble/question_bubble.dart | 1 + .../presentation/widgets/pop_up_action.dart | 3 ++ 18 files changed, 59 insertions(+), 46 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/toolbar/board_toolbar.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/toolbar/board_toolbar.dart index 57f12e218f..c75456ac1d 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/toolbar/board_toolbar.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/toolbar/board_toolbar.dart @@ -65,6 +65,7 @@ class _SettingButtonState extends State<_SettingButton> { return AppFlowyPopover( controller: popoverController, direction: PopoverDirection.leftWithTopAligned, + offset: const Offset(-8, 0), triggerActions: PopoverTriggerFlags.none, constraints: BoxConstraints.loose(const Size(260, 400)), margin: EdgeInsets.zero, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_option_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_option_editor.dart index 29e6203dc3..4974490642 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_option_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_option_editor.dart @@ -87,7 +87,7 @@ class _SwitchFieldButton extends StatelessWidget { asBarrier: true, triggerActions: PopoverTriggerFlags.click, mutex: popoverMutex, - offset: const Offset(20, 0), + offset: const Offset(8, 0), popupBuilder: (popOverContext) { return FieldTypeList(onSelectField: (newFieldType) { context diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart index 8e29b785e7..a92ba48fd8 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart @@ -80,7 +80,7 @@ class DateTypeOptionWidget extends TypeOptionWidget { mutex: popoverMutex, asBarrier: true, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, - offset: const Offset(20, 0), + offset: const Offset(8, 0), constraints: BoxConstraints.loose(const Size(460, 440)), popupBuilder: (popoverContext) { return DateFormatList( @@ -107,7 +107,7 @@ class DateTypeOptionWidget extends TypeOptionWidget { mutex: popoverMutex, asBarrier: true, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, - offset: const Offset(20, 0), + offset: const Offset(8, 0), constraints: BoxConstraints.loose(const Size(460, 440)), popupBuilder: (BuildContext popoverContext) { return TimeFormatList( diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/number.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/number.dart index 92018009af..fd5824a0d1 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/number.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/number.dart @@ -77,7 +77,7 @@ class NumberTypeOptionWidget extends TypeOptionWidget { mutex: popoverMutex, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, - offset: const Offset(20, 0), + offset: const Offset(8, 0), constraints: BoxConstraints.loose(const Size(460, 440)), margin: EdgeInsets.zero, child: Padding( diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select_option.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select_option.dart index 27965ca186..e30f460c16 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select_option.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select_option.dart @@ -203,7 +203,7 @@ class _OptionCellState extends State<_OptionCell> { return AppFlowyPopover( controller: _popoverController, mutex: widget.popoverMutex, - offset: const Offset(20, 0), + offset: const Offset(8, 0), margin: EdgeInsets.zero, asBarrier: true, constraints: BoxConstraints.loose(const Size(460, 460)), diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/sort/sort_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/sort/sort_editor.dart index 0bcaee5175..4bd72caa07 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/sort/sort_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/sort/sort_editor.dart @@ -176,7 +176,7 @@ class _AddSortButtonState extends State<_AddSortButton> { mutex: widget.popoverMutex, direction: PopoverDirection.bottomWithLeftAligned, constraints: BoxConstraints.loose(const Size(200, 300)), - offset: const Offset(0, 10), + offset: const Offset(0, 8), triggerActions: PopoverTriggerFlags.none, asBarrier: true, child: SizedBox( diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/filter_button.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/filter_button.dart index 453e277b1d..38dfc83818 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/filter_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/filter_button.dart @@ -30,20 +30,23 @@ class _FilterButtonState extends State { return _wrapPopover( context, - FlowyTextButton( - LocaleKeys.grid_settings_filter.tr(), - fontColor: textColor, - fillColor: Colors.transparent, - hoverColor: AFThemeExtension.of(context).lightGreyHover, - padding: GridSize.typeOptionContentInsets, - onPressed: () { - final bloc = context.read(); - if (bloc.state.filters.isEmpty) { - _popoverController.show(); - } else { - bloc.add(const GridFilterMenuEvent.toggleMenu()); - } - }, + SizedBox( + height: 26, + child: FlowyTextButton( + LocaleKeys.grid_settings_filter.tr(), + fontColor: textColor, + fillColor: Colors.transparent, + hoverColor: AFThemeExtension.of(context).lightGreyHover, + padding: GridSize.typeOptionContentInsets, + onPressed: () { + final bloc = context.read(); + if (bloc.state.filters.isEmpty) { + _popoverController.show(); + } else { + bloc.add(const GridFilterMenuEvent.toggleMenu()); + } + }, + ), ), ); }, @@ -55,7 +58,7 @@ class _FilterButtonState extends State { controller: _popoverController, direction: PopoverDirection.bottomWithLeftAligned, constraints: BoxConstraints.loose(const Size(200, 300)), - offset: const Offset(0, 10), + offset: const Offset(0, 8), triggerActions: PopoverTriggerFlags.none, child: child, popupBuilder: (BuildContext context) { diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/grid_property.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/grid_property.dart index 59cd2cb99b..9b65628f4f 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/grid_property.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/grid_property.dart @@ -109,7 +109,7 @@ class _GridPropertyCellState extends State<_GridPropertyCell> { return AppFlowyPopover( mutex: widget.popoverMutex, controller: _popoverController, - offset: const Offset(20, 0), + offset: const Offset(8, 0), direction: PopoverDirection.leftWithTopAligned, constraints: BoxConstraints.loose(const Size(240, 400)), triggerActions: PopoverTriggerFlags.none, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/setting_button.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/setting_button.dart index 62a9bea883..93baeed518 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/setting_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/setting_button.dart @@ -41,23 +41,26 @@ class _SettingButtonState extends State { ); }, builder: (context, settingContext) { - return AppFlowyPopover( - controller: _popoverController, - constraints: BoxConstraints.loose(const Size(260, 400)), - direction: PopoverDirection.bottomWithLeftAligned, - offset: const Offset(0, 10), - margin: EdgeInsets.zero, - triggerActions: PopoverTriggerFlags.none, - child: FlowyTextButton( - LocaleKeys.settings_title.tr(), - fillColor: Colors.transparent, - hoverColor: AFThemeExtension.of(context).lightGreyHover, - padding: GridSize.typeOptionContentInsets, - onPressed: () => _popoverController.show(), + return SizedBox( + height: 26, + child: AppFlowyPopover( + controller: _popoverController, + constraints: BoxConstraints.loose(const Size(260, 400)), + direction: PopoverDirection.bottomWithLeftAligned, + offset: const Offset(0, 8), + margin: EdgeInsets.zero, + triggerActions: PopoverTriggerFlags.none, + child: FlowyTextButton( + LocaleKeys.settings_title.tr(), + fillColor: Colors.transparent, + hoverColor: AFThemeExtension.of(context).lightGreyHover, + padding: GridSize.typeOptionContentInsets, + onPressed: () => _popoverController.show(), + ), + popupBuilder: (BuildContext context) { + return _GridSettingListPopover(settingContext: settingContext); + }, ), - popupBuilder: (BuildContext context) { - return _GridSettingListPopover(settingContext: settingContext); - }, ); }, ); diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/sort_button.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/sort_button.dart index 8469383cf1..7a38b73d08 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/sort_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/toolbar/sort_button.dart @@ -58,7 +58,7 @@ class _SortButtonState extends State { controller: _popoverController, direction: PopoverDirection.bottomWithLeftAligned, constraints: BoxConstraints.loose(const Size(200, 300)), - offset: const Offset(0, 10), + offset: const Offset(0, 8), margin: const EdgeInsets.all(6), triggerActions: PopoverTriggerFlags.none, child: child, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/checklist_cell/checklist_cell_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/checklist_cell/checklist_cell_editor.dart index 9d30b122a3..3e5d744e1e 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/checklist_cell/checklist_cell_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/checklist_cell/checklist_cell_editor.dart @@ -145,7 +145,7 @@ class _ChecklistOptionCellState extends State<_ChecklistOptionCell> { Widget _wrapPopover(Widget child) { return AppFlowyPopover( controller: _popoverController, - offset: const Offset(20, 0), + offset: const Offset(8, 0), asBarrier: true, constraints: BoxConstraints.loose(const Size(200, 300)), mutex: widget.popoverMutex, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_editor.dart index 5a49415d4c..0c0313c9fe 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_editor.dart @@ -376,7 +376,7 @@ class _DateTypeOptionButton extends StatelessWidget { return AppFlowyPopover( mutex: popoverMutex, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, - offset: const Offset(20, 0), + offset: const Offset(8, 0), margin: EdgeInsets.zero, constraints: BoxConstraints.loose(const Size(140, 100)), child: Padding( @@ -431,7 +431,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> { AppFlowyPopover( mutex: timeSettingPopoverMutex, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, - offset: const Offset(20, 0), + offset: const Offset(8, 0), popupBuilder: (BuildContext context) { return DateFormatList( selectedFormat: widget.dateTypeOptionPB.dateFormat, @@ -449,7 +449,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> { AppFlowyPopover( mutex: timeSettingPopoverMutex, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, - offset: const Offset(20, 0), + offset: const Offset(8, 0), popupBuilder: (BuildContext context) { return TimeFormatList( selectedFormat: widget.dateTypeOptionPB.timeFormat, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_editor.dart index f65566320d..024e88405c 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_editor.dart @@ -285,7 +285,7 @@ class _SelectOptionCellState extends State<_SelectOptionCell> { ); return AppFlowyPopover( controller: _popoverController, - offset: const Offset(20, 0), + offset: const Offset(8, 0), margin: EdgeInsets.zero, asBarrier: true, constraints: BoxConstraints.loose(const Size(200, 460)), diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/url_cell/url_cell.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/url_cell/url_cell.dart index b3c0553846..9ab086e356 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/url_cell/url_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/url_cell/url_cell.dart @@ -127,7 +127,7 @@ class _GridURLCellState extends GridCellState { constraints: BoxConstraints.loose(const Size(300, 160)), direction: PopoverDirection.bottomWithLeftAligned, triggerActions: PopoverTriggerFlags.none, - offset: const Offset(0, 20), + offset: const Offset(0, 8), child: SizedBox.expand( child: GestureDetector( child: Align(alignment: Alignment.centerLeft, child: richText), @@ -210,7 +210,7 @@ class _EditURLAccessoryState extends State<_EditURLAccessory> constraints: BoxConstraints.loose(const Size(300, 160)), controller: _popoverController, direction: PopoverDirection.bottomWithLeftAligned, - offset: const Offset(0, 20), + offset: const Offset(0, 8), child: svgWidget( "editor/edit", color: Theme.of(context).colorScheme.onSurface, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart index 042b9e9492..84e9b179cb 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart @@ -82,6 +82,7 @@ class ShareActionList extends StatelessWidget { final docShareBloc = context.read(); return PopoverActionList( direction: PopoverDirection.bottomWithCenterAligned, + offset: const Offset(0, 8), actions: ShareAction.values .map((action) => ShareActionWrapper(action)) .toList(), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/add_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/add_button.dart index 642cc063da..351012bc38 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/add_button.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/add_button.dart @@ -48,6 +48,7 @@ class AddButton extends StatelessWidget { return PopoverActionList( direction: PopoverDirection.bottomWithLeftAligned, actions: actions, + offset: const Offset(0, 8), buildChild: (controller) { return FlowyIconButton( width: 22, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart index 6f91748661..bce35021ef 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart @@ -42,6 +42,7 @@ class BubbleActionList extends StatelessWidget { return PopoverActionList( direction: PopoverDirection.topWithRightAligned, actions: actions, + offset: const Offset(0, -8), buildChild: (controller) { return FlowyTextButton( '?', diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart index df38504c4b..a9172256ba 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart @@ -13,6 +13,7 @@ class PopoverActionList extends StatefulWidget { final Widget Function(PopoverController) buildChild; final VoidCallback? onClosed; final bool asBarrier; + final Offset offset; const PopoverActionList({ required this.actions, @@ -22,6 +23,7 @@ class PopoverActionList extends StatefulWidget { this.onClosed, this.direction = PopoverDirection.rightWithTopAligned, this.asBarrier = false, + this.offset = Offset.zero, this.constraints = const BoxConstraints( minWidth: 120, maxWidth: 460, @@ -54,6 +56,7 @@ class _PopoverActionListState constraints: widget.constraints, direction: widget.direction, mutex: widget.mutex, + offset: widget.offset, triggerActions: PopoverTriggerFlags.none, onClose: widget.onClosed, popupBuilder: (BuildContext popoverContext) { From 1dbfd838ef80d85b39a0246938368337401b372a Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Fri, 17 Mar 2023 11:01:14 +0800 Subject: [PATCH 5/5] feat: update kanban demo (#2008) --- .../application/database_controller.dart | 7 +++-- .../application/database_view_service.dart | 10 +++--- .../board/application/board_bloc.dart | 4 +-- .../components/tests/TestGroup.tsx | 31 +++++++++++++++++++ .../effects/database/database_bd_svc.ts | 18 ++++++++--- .../effects/database/database_controller.ts | 2 +- .../select_option_controller/util.rs | 3 +- 7 files changed, 59 insertions(+), 16 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart index e075cf5b92..dac75a6e52 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart @@ -159,8 +159,11 @@ class DatabaseController { ); } - Future> moveRow(RowPB fromRow, - {RowPB? toRow, String? groupId}) { + Future> moveRow({ + required RowPB fromRow, + required String groupId, + RowPB? toRow, + }) { return _databaseViewBackendSvc.moveRow( fromRowId: fromRow.id, toGroupId: groupId, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart index 842eeac90c..5ecaad6ef3 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart @@ -46,15 +46,13 @@ class DatabaseViewBackendService { Future> moveRow({ required String fromRowId, - required String? toGroupId, - required String? toRowId, + required String toGroupId, + String? toRowId, }) { var payload = MoveGroupRowPayloadPB.create() ..viewId = viewId - ..fromRowId = fromRowId; - if (toGroupId != null) { - payload.toGroupId = toGroupId; - } + ..fromRowId = fromRowId + ..toGroupId = toGroupId; if (toRowId != null) { payload.toRowId = toRowId; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart index 1ee14a95d0..61911b5318 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart @@ -54,7 +54,7 @@ class BoardBloc extends Bloc { final toRow = groupControllers[groupId]?.rowAtIndex(toIndex); if (fromRow != null) { _databaseController.moveRow( - fromRow, + fromRow: fromRow, toRow: toRow, groupId: groupId, ); @@ -70,7 +70,7 @@ class BoardBloc extends Bloc { final toRow = groupControllers[toGroupId]?.rowAtIndex(toIndex); if (fromRow != null) { _databaseController.moveRow( - fromRow, + fromRow: fromRow, toRow: toRow, groupId: toGroupId, ); diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx index a88065f253..bbcf7a860c 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx +++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx @@ -69,6 +69,37 @@ async function moveKanbanBoardRow() { // Create row in no status group const firstGroup = databaseController.groups.getValue()[1]; const secondGroup = databaseController.groups.getValue()[2]; + // subscribe the group changes + firstGroup.subscribe({ + onRemoveRow: (groupId, deleteRowId) => { + console.log(groupId + 'did remove:' + deleteRowId); + }, + onInsertRow: (groupId, rowPB) => { + console.log(groupId + 'did insert:' + rowPB.id); + }, + onUpdateRow: (groupId, rowPB) => { + console.log(groupId + 'did update:' + rowPB.id); + }, + onCreateRow: (groupId, rowPB) => { + console.log(groupId + 'did create:' + rowPB.id); + }, + }); + + secondGroup.subscribe({ + onRemoveRow: (groupId, deleteRowId) => { + console.log(groupId + 'did remove:' + deleteRowId); + }, + onInsertRow: (groupId, rowPB) => { + console.log(groupId + 'did insert:' + rowPB.id); + }, + onUpdateRow: (groupId, rowPB) => { + console.log(groupId + 'did update:' + rowPB.id); + }, + onCreateRow: (groupId, rowPB) => { + console.log(groupId + 'did create:' + rowPB.id); + }, + }); + const row = firstGroup.rowAtIndex(0).unwrap(); await databaseController.moveRow(row.id, secondGroup.groupId); diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts index 433c6acb17..f66f78ee15 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts @@ -56,11 +56,19 @@ export class DatabaseBackendService { return DatabaseEventCreateRow(payload); }; - moveRow = (rowId: string, groupId?: string) => { - const payload = MoveGroupRowPayloadPB.fromObject({ view_id: this.viewId, from_row_id: rowId }); - if (groupId !== undefined) { - payload.to_group_id = groupId; + /// Move the row from one group to another group + /// [groupId] can be the moving row's group id or others. + /// [toRowId] is used to locate the moving row location. + moveGroupRow = (fromRowId: string, groupId: string, toRowId?: string) => { + const payload = MoveGroupRowPayloadPB.fromObject({ + view_id: this.viewId, + from_row_id: fromRowId, + to_group_id: groupId, + }); + if (toRowId !== undefined) { + payload.to_row_id = toRowId; } + return DatabaseEventMoveGroupRow(payload); }; @@ -88,6 +96,8 @@ export class DatabaseBackendService { return DatabaseEventGetGroup(payload); }; + /// Get all groups in database + /// It should only call once after the board open loadGroups = () => { const payload = DatabaseViewIdPB.fromObject({ value: this.viewId }); return DatabaseEventGetGroups(payload); diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts index e47119c49a..cdd3bd76aa 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts @@ -76,7 +76,7 @@ export class DatabaseController { }; moveRow = (rowId: string, groupId: string) => { - return this.backendService.moveRow(rowId, groupId); + return this.backendService.moveGroupRow(rowId, groupId); }; moveGroup = (fromGroupId: string, toGroupId: string) => { diff --git a/frontend/rust-lib/flowy-database/src/services/group/controller_impls/select_option_controller/util.rs b/frontend/rust-lib/flowy-database/src/services/group/controller_impls/select_option_controller/util.rs index d630df5d13..b800cf988f 100644 --- a/frontend/rust-lib/flowy-database/src/services/group/controller_impls/select_option_controller/util.rs +++ b/frontend/rust-lib/flowy-database/src/services/group/controller_impls/select_option_controller/util.rs @@ -115,6 +115,8 @@ pub fn move_group_row( } // Update the corresponding row's cell content. + // If the from_index is none which means the row is not belong to this group before and + // it is moved from other groups. if from_index.is_none() { let cell_rev = make_inserted_cell_rev(&group.id, field_rev); if let Some(cell_rev) = cell_rev { @@ -126,7 +128,6 @@ pub fn move_group_row( row_changeset .cell_by_field_id .insert(field_rev.id.clone(), cell_rev); - changeset.updated_rows.push(RowPB::from(*row_rev)); } } }