Skip to content

High performance self-hosted photo and video management solution.

fix: show delete on device when asset has a local match (#22143)

shenlong53c67f4d7110
diff --git a/mobile/lib/utils/action_button.utils.dart b/mobile/lib/utils/action_button.utils.dart
index 4dfc0398bd..090aeeeaa7 100644
--- a/mobile/lib/utils/action_button.utils.dart
+++ b/mobile/lib/utils/action_button.utils.dart
@@ -102,7 +102,7 @@ enum ActionButtonType {
context.asset.hasRemote,
ActionButtonType.deleteLocal =>
!context.isInLockedView && //
- context.asset.storage == AssetState.local,
+ context.asset.hasLocal,
ActionButtonType.upload =>
!context.isInLockedView && //
context.asset.storage == AssetState.local,
diff --git a/mobile/test/utils/action_button_utils_test.dart b/mobile/test/utils/action_button_utils_test.dart
index 497246e2a1..f8c51173d7 100644
--- a/mobile/test/utils/action_button_utils_test.dart
+++ b/mobile/test/utils/action_button_utils_test.dart
@@ -502,6 +502,21 @@ void main() {
expect(ActionButtonType.deleteLocal.shouldShow(context), isFalse);
});
+
+ test('should show when asset is merged', () {
+ final context = ActionButtonContext(
+ asset: mergedAsset,
+ isOwner: true,
+ isArchived: false,
+ isTrashEnabled: true,
+ isInLockedView: false,
+ currentAlbum: null,
+ advancedTroubleshooting: false,
+ source: ActionSource.timeline,
+ );
+
+ expect(ActionButtonType.deleteLocal.shouldShow(context), isTrue);
+ });
});
group('upload button', () {