mirror of
https://github.com/immich-app/immich.git
synced 2026-09-30 21:28:12 +08:00
fix(mobile): don't stack an upload with itself (#31851)
This commit is contained in:
@@ -204,7 +204,7 @@ class AssetService {
|
||||
try {
|
||||
// previous_checksum still points at the version the server had before this upload
|
||||
final previousId = await _localRepository.getPreviousRemoteId(localId);
|
||||
if (previousId != null) {
|
||||
if (previousId != null && previousId != remoteId) {
|
||||
await _apiRepository.stack([remoteId, previousId]);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -150,6 +150,15 @@ void main() {
|
||||
verify(() => mocks.localAsset.repo.updatePreviousChecksum('local', 'sha')).called(1);
|
||||
});
|
||||
|
||||
test('does not stack an upload onto itself', () async {
|
||||
when(() => mocks.localAsset.repo.getPreviousRemoteId('local')).thenAnswer((_) async => 'remote');
|
||||
|
||||
await sut.stackEditedUpload('local', 'remote', 'sha');
|
||||
|
||||
verifyNever(() => apiRepository.stack(any()));
|
||||
verify(() => mocks.localAsset.repo.updatePreviousChecksum('local', 'sha')).called(1);
|
||||
});
|
||||
|
||||
test('records the uploaded checksum even when the stack call fails', () async {
|
||||
when(() => mocks.localAsset.repo.getPreviousRemoteId('local')).thenAnswer((_) async => 'previous');
|
||||
when(() => apiRepository.stack(any())).thenThrow(Exception('offline'));
|
||||
|
||||
Reference in New Issue
Block a user