mirror of
https://github.com/bitwarden/server
synced 2026-02-28 02:13:19 +00:00
[PM-32764] Archive Sync Notifications Double Sync Solve (#7093)
* exclude double sync on archive and unarchive
This commit is contained in:
@@ -87,7 +87,7 @@ public interface IPushNotificationService
|
||||
ExcludeCurrentContext = true,
|
||||
});
|
||||
|
||||
Task PushSyncCiphersAsync(Guid userId)
|
||||
Task PushSyncCiphersAsync(Guid userId, bool excludeCurrentContext = false)
|
||||
=> PushAsync(new PushNotification<UserPushNotification>
|
||||
{
|
||||
Type = PushType.SyncCiphers,
|
||||
@@ -100,7 +100,7 @@ public interface IPushNotificationService
|
||||
Date = TimeProvider.GetUtcNow().UtcDateTime,
|
||||
#pragma warning restore BWP0001 // Type or member is obsolete
|
||||
},
|
||||
ExcludeCurrentContext = false,
|
||||
ExcludeCurrentContext = excludeCurrentContext,
|
||||
});
|
||||
|
||||
Task PushSyncVaultAsync(Guid userId)
|
||||
|
||||
@@ -52,9 +52,10 @@ public class ArchiveCiphersCommand : IArchiveCiphersCommand
|
||||
});
|
||||
|
||||
// Will not log an event because the archive feature is limited to individual ciphers, and event logs only apply to organization ciphers.
|
||||
// Add event logging here if this is expanded to organization ciphers in the future.
|
||||
|
||||
await _pushService.PushSyncCiphersAsync(archivingUserId);
|
||||
// ExcludeCurrentContext to avoid double syncing when archiving a cipher
|
||||
|
||||
await _pushService.PushSyncCiphersAsync(archivingUserId, true);
|
||||
|
||||
return archivingCiphers;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,10 @@ public class UnarchiveCiphersCommand : IUnarchiveCiphersCommand
|
||||
c.ArchivedDate = null;
|
||||
});
|
||||
// Will not log an event because the archive feature is limited to individual ciphers, and event logs only apply to organization ciphers.
|
||||
// Add event logging here if this is expanded to organization ciphers in the future.
|
||||
|
||||
await _pushService.PushSyncCiphersAsync(unarchivingUserId);
|
||||
// ExcludeCurrentContext to avoid double syncing when unarchiving a cipher
|
||||
|
||||
await _pushService.PushSyncCiphersAsync(unarchivingUserId, true);
|
||||
|
||||
return unarchivingCiphers;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ArchiveCiphersCommandTest
|
||||
: ids.All(id => cipherList.Contains(cipher))),
|
||||
user.Id);
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(pushNotificationsCalls)
|
||||
.PushSyncCiphersAsync(user.Id);
|
||||
.PushSyncCiphersAsync(user.Id, true);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
@@ -43,7 +43,7 @@ public class UnarchiveCiphersCommandTest
|
||||
: ids.All(id => cipherList.Contains(cipher))),
|
||||
user.Id);
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(pushNotificationsCalls)
|
||||
.PushSyncCiphersAsync(user.Id);
|
||||
.PushSyncCiphersAsync(user.Id, true);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
Reference in New Issue
Block a user