mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-18 20:05:18 +01:00
Actually use updated account in getBackupAuthCredentials
This commit is contained in:
committed by
Jon Chambers
parent
e0632e9800
commit
a99635fbee
@@ -185,22 +185,24 @@ public class BackupAuthManager {
|
||||
* voucher's expiration will include paid backup access. If the BackupVoucher exists but is already expired, this
|
||||
* method will also remove the expired voucher from the account.
|
||||
*
|
||||
* @param account The account to create the credentials for
|
||||
* @param originalAccount The account to create the credentials for
|
||||
* @param redemptionRange The time range to return credentials for
|
||||
* @return Credentials and the day on which they may be redeemed
|
||||
*/
|
||||
public Map<BackupCredentialType, List<Credential>> getBackupAuthCredentials(
|
||||
final Account account,
|
||||
final Account originalAccount,
|
||||
final RedemptionRange redemptionRange) throws BackupNotFoundException {
|
||||
|
||||
// If the account has an expired payment, clear it before continuing
|
||||
if (hasExpiredVoucher(account)) {
|
||||
final Account updated = accountsManager.update(account, a -> {
|
||||
final Account account;
|
||||
if (hasExpiredVoucher(originalAccount)) {
|
||||
account = accountsManager.update(originalAccount, a -> {
|
||||
// Re-check in case we raced with an update
|
||||
if (hasExpiredVoucher(a)) {
|
||||
a.setBackupVoucher(null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
account = originalAccount;
|
||||
}
|
||||
|
||||
final Map<BackupCredentialType, List<Credential>> credentials = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user