Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix smart album auto-add after local data changes

laurensprieme6f727270999
diff --git a/mobile/apps/photos/changes/smart-album-auto-add.md b/mobile/apps/photos/changes/smart-album-auto-add.md
new file mode 100644
index 0000000000..d822ade044
--- /dev/null
+++ b/mobile/apps/photos/changes/smart-album-auto-add.md
@@ -0,0 +1 @@
+- Fixed album auto-add missing photos after first setup or when person matches become available during sync.
diff --git a/mobile/apps/photos/lib/services/smart_albums_service.dart b/mobile/apps/photos/lib/services/smart_albums_service.dart
index 67d77c501b..2fcef6c0cf 100644
--- a/mobile/apps/photos/lib/services/smart_albums_service.dart
+++ b/mobile/apps/photos/lib/services/smart_albums_service.dart
@@ -126,8 +126,6 @@ class SmartAlbumsService {
SmartAlbumSyncingEvent(collectionId: collectionId, isSyncing: false),
);
- final infoMap = config.infoMap;
-
final updatedAtMap = await entityService.getUpdatedAts(
EntityType.cgroup,
config.personIDs.toList(),
@@ -138,9 +136,7 @@ class SmartAlbumsService {
var newConfig = config;
for (final personId in config.personIDs) {
- if (updatedAtMap[personId] == null ||
- infoMap[personId] != null &&
- (updatedAtMap[personId]! <= infoMap[personId]!.updatedAt)) {
+ if (updatedAtMap[personId] == null) {
continue;
}
@@ -157,6 +153,10 @@ class SmartAlbumsService {
e.ownerID != userId,
);
+ if (fileIds.isEmpty) {
+ continue;
+ }
+
pendingSyncFiles = {
...pendingSyncFiles,
personId: fileIds.map((e) => e.uploadedFileID!).toSet(),
@@ -253,7 +253,7 @@ class SmartAlbumsService {
addWithCustomID: addWithCustomID,
);
- _lastCacheRefreshTime = 0;
+ clearCache();
return result;
}
@@ -264,6 +264,6 @@ class SmartAlbumsService {
_logger.fine("Deleting entry for collection ($collectionId)");
final id = getId(collectionId: collectionId, userId: userId);
await entityService.deleteEntry(id);
- _lastCacheRefreshTime = 0;
+ clearCache();
}
}