diff --git a/i18n/en.json b/i18n/en.json index d5d02db7d3..7ead6ae3e1 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1753,6 +1753,7 @@ "shared_album_activity_remove_title": "Delete Activity", "shared_album_section_people_action_error": "Error leaving/removing from album", "shared_album_section_people_action_leave": "Remove user from album", + "shared_album_section_people_action_leave_v2": "Leave album", "shared_album_section_people_action_remove_user": "Remove user from album", "shared_album_section_people_title": "PEOPLE", "shared_by": "Shared by", diff --git a/mobile/lib/presentation/pages/drift_album_options.page.dart b/mobile/lib/presentation/pages/drift_album_options.page.dart index 6c423be671..84a9df7331 100644 --- a/mobile/lib/presentation/pages/drift_album_options.page.dart +++ b/mobile/lib/presentation/pages/drift_album_options.page.dart @@ -48,7 +48,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget { void leaveAlbum() async { try { await ref.read(remoteAlbumProvider.notifier).leaveAlbum(album.id, userId: userId); - context.navigateTo(const MainTimelineRoute(children: [DriftAlbumsRoute()])); + context.navigateTo(const DriftAlbumsRoute()); } catch (_) { showErrorMessage(); } @@ -58,7 +58,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget { try { await ref.read(remoteAlbumProvider.notifier).removeUser(album.id, user.id); ref.invalidate(remoteAlbumSharedUsersProvider(album.id)); - } catch (error) { + } catch (_) { showErrorMessage(); } @@ -100,7 +100,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget { actions = [ ListTile( leading: const Icon(Icons.exit_to_app_rounded), - title: const Text("shared_album_section_people_action_leave").tr(), + title: const Text("shared_album_section_people_action_leave_v2").tr(), onTap: leaveAlbum, ), ]; diff --git a/mobile/lib/providers/infrastructure/remote_album.provider.dart b/mobile/lib/providers/infrastructure/remote_album.provider.dart index 4359f842b5..a9c1b88a15 100644 --- a/mobile/lib/providers/infrastructure/remote_album.provider.dart +++ b/mobile/lib/providers/infrastructure/remote_album.provider.dart @@ -163,7 +163,11 @@ class RemoteAlbumNotifier extends Notifier { Future leaveAlbum(String albumId, {required String userId}) async { await _remoteAlbumService.removeUser(albumId, userId: userId); - await deleteAlbum(albumId); + + final updatedAlbums = state.albums.where((album) => album.id != albumId).toList(); + final updatedFilteredAlbums = state.filteredAlbums.where((album) => album.id != albumId).toList(); + + state = state.copyWith(albums: updatedAlbums, filteredAlbums: updatedFilteredAlbums); } Future setActivityStatus(String albumId, bool enabled) {