mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: remote sync clean up
This commit is contained in:
@@ -612,12 +612,15 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
||||
|
||||
final validUsers = {currentUserId, ...partnerIds.nonNulls};
|
||||
|
||||
// Asset is not owned by the current user or any of their partners and is not part of any (shared) album
|
||||
// Asset is not owned by the current user or any of their partners and is not part of any (shared) album or memory
|
||||
// Likely a stale asset that was previously shared but has been removed
|
||||
await _db.remoteAssetEntity.deleteWhere((asset) {
|
||||
return asset.ownerId.isNotIn(validUsers) &
|
||||
asset.id.isNotInQuery(
|
||||
_db.remoteAlbumAssetEntity.selectOnly()..addColumns([_db.remoteAlbumAssetEntity.assetId]),
|
||||
) &
|
||||
asset.id.isNotInQuery(
|
||||
_db.memoryAssetEntity.selectOnly()..addColumns([_db.memoryAssetEntity.assetId]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user