Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[Hide] Remove files from collections owned by others

Neeraj Guptae89d32355f5d
diff --git a/lib/services/hidden_service.dart b/lib/services/hidden_service.dart
index 7d1672fa03..6f6457a9d8 100644
--- a/lib/services/hidden_service.dart
+++ b/lib/services/hidden_service.dart
@@ -141,11 +141,18 @@ extension HiddenService on CollectionsService {
_logger.finest('file already part of hidden collection');
continue;
}
- await move(
- entry.value,
- toCollectionID: defaultHiddenCollection.id,
- fromCollectionID: entry.key,
- );
+ final Collection? c = getCollectionByID(entry.key);
+ // if the collection is not owned by the user, remove the file from the
+ // collection
+ if (c != null && !c.isOwner(userID)) {
+ await removeFromCollection(entry.key, entry.value);
+ } else {
+ await move(
+ entry.value,
+ toCollectionID: defaultHiddenCollection.id,
+ fromCollectionID: entry.key,
+ );
+ }
}
Bus.instance.fire(
LocalPhotosUpdatedEvent(