From 8f17f453391f9718efd512969d8cac35ca02fc8c Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Fri, 17 Sep 2021 11:26:30 -0500 Subject: [PATCH] Reorder creating of testing badges Need their expiration time to always get refreshed on set so reorder how they're created to ensure that's the case. --- .../controllers/ProfileController.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java index 22027e4fb..4c498244e 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java @@ -489,6 +489,14 @@ public class ProfileController { continue; } + // This is for testing badges and allows them to be added to an account at any time with an expiration of 1 day + // in the future. + BadgeConfiguration badgeConfiguration = badgeConfigurationMap.get(badgeId); + if (badgeConfiguration != null && "testing".equals(badgeConfiguration.getCategory())) { + result.put(badgeId, new AccountBadge(badgeId, clock.instant().plus(Duration.ofDays(1)), true)); + continue; + } + // reordering or making visible existing badges if (existingBadges.containsKey(badgeId)) { AccountBadge accountBadge = existingBadges.get(badgeId); @@ -496,14 +504,6 @@ public class ProfileController { accountBadge = new AccountBadge(badgeId, accountBadge.getExpiration(), true); } result.put(badgeId, accountBadge); - continue; - } - - // This is for testing badges and allows them to be added to an account at any time with an expiration of 1 day - // in the future. - BadgeConfiguration badgeConfiguration = badgeConfigurationMap.get(badgeId); - if (badgeConfiguration != null && "testing".equals(badgeConfiguration.getCategory())) { - result.put(badgeId, new AccountBadge(badgeId, clock.instant().plus(Duration.ofDays(1)), true)); } }