diff --git a/service/config/sample.yml b/service/config/sample.yml index e28dec7b8..f6d70d592 100644 --- a/service/config/sample.yml +++ b/service/config/sample.yml @@ -365,8 +365,6 @@ badges: svgs: - light: example-light.svg dark: example-dark.svg - badgeIdsEnabledForAll: - - TEST receiptLevels: '1': TEST diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverter.java b/service/src/main/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverter.java index b73ffdc0e..40c7aae07 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverter.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverter.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.badges; import com.google.common.annotations.VisibleForTesting; import java.time.Clock; -import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.List; @@ -31,7 +30,6 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter, B private final Clock clock; private final Map knownBadges; - private final List badgeIdsEnabledForAll; private final HeaderControlledResourceBundleLookup headerControlledResourceBundleLookup; public ConfiguredProfileBadgeConverter( @@ -41,7 +39,6 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter, B this.clock = clock; this.knownBadges = badgesConfiguration.getBadges().stream() .collect(Collectors.toMap(BadgeConfiguration::getId, Function.identity())); - this.badgeIdsEnabledForAll = badgesConfiguration.getBadgeIdsEnabledForAll(); this.headerControlledResourceBundleLookup = headerControlledResourceBundleLookup; } @@ -73,7 +70,7 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter, B final List acceptableLanguages, final List accountBadges, final boolean isSelf) { - if (accountBadges.isEmpty() && badgeIdsEnabledForAll.isEmpty()) { + if (accountBadges.isEmpty()) { return List.of(); } @@ -99,20 +96,6 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter, B accountBadge.visible()); }) .collect(Collectors.toCollection(ArrayList::new)); - badges.addAll(badgeIdsEnabledForAll.stream().filter(knownBadges::containsKey).map(id -> { - BadgeConfiguration configuration = knownBadges.get(id); - return newBadge( - isSelf, - id, - configuration.getCategory(), - resourceBundle.getString(id + "_name"), - resourceBundle.getString(id + "_description"), - configuration.getSprites(), - configuration.getSvg(), - configuration.getSvgs(), - now.plus(Duration.ofDays(1)), - true); - }).collect(Collectors.toList())); return badges; } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/BadgesConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/BadgesConfiguration.java index 4fec0f21a..75f775378 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/BadgesConfiguration.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/BadgesConfiguration.java @@ -21,16 +21,13 @@ import java.util.stream.Collectors; public class BadgesConfiguration { private final List badges; - private final List badgeIdsEnabledForAll; private final Map receiptLevels; @JsonCreator public BadgesConfiguration( @JsonProperty("badges") @JsonSetter(nulls = Nulls.AS_EMPTY) final List badges, - @JsonProperty("badgeIdsEnabledForAll") @JsonSetter(nulls = Nulls.AS_EMPTY) final List badgeIdsEnabledForAll, @JsonProperty("receiptLevels") @JsonSetter(nulls = Nulls.AS_EMPTY) final Map receiptLevels) { this.badges = Objects.requireNonNull(badges); - this.badgeIdsEnabledForAll = Objects.requireNonNull(badgeIdsEnabledForAll); this.receiptLevels = Objects.requireNonNull(receiptLevels); } @@ -40,12 +37,6 @@ public class BadgesConfiguration { return badges; } - @Valid - @NotNull - public List getBadgeIdsEnabledForAll() { - return badgeIdsEnabledForAll; - } - @Valid @NotNull public Map getReceiptLevels() { diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverterTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverterTest.java index 529d8c17a..b38e8a5cb 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverterTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/badges/ConfiguredProfileBadgeConverterTest.java @@ -83,7 +83,7 @@ public class ConfiguredProfileBadgeConverterTest { return objects; } }; - return new BadgesConfiguration(badges, List.of(), Map.of()); + return new BadgesConfiguration(badges, Map.of()); } private BadgeConfiguration getBadge(BadgesConfiguration badgesConfiguration, int i) { diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DonationControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DonationControllerTest.java index f20d21247..bcc3e7fc3 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DonationControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DonationControllerTest.java @@ -75,7 +75,6 @@ class DonationControllerTest { List.of(new BadgeSvg("sl", "sd"), new BadgeSvg("ml", "md"), new BadgeSvg("ll", "ld"))), new BadgeConfiguration("TEST3", "testing", List.of("l", "m", "h", "x", "xx", "xxx"), "SVG", List.of(new BadgeSvg("sl", "sd"), new BadgeSvg("ml", "md"), new BadgeSvg("ll", "ld")))), - List.of("TEST"), Map.of(1L, "TEST1", 2L, "TEST2", 3L, "TEST3")); } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java index 1831ba8f0..61274d070 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java @@ -168,7 +168,7 @@ class ProfileControllerTest { new BadgeConfiguration("TEST1", "testing", List.of("l", "m", "h", "x", "xx", "xxx"), "SVG", List.of(new BadgeSvg("sl", "sd"), new BadgeSvg("ml", "md"), new BadgeSvg("ll", "ld"))), new BadgeConfiguration("TEST2", "testing", List.of("l", "m", "h", "x", "xx", "xxx"), "SVG", List.of(new BadgeSvg("sl", "sd"), new BadgeSvg("ml", "md"), new BadgeSvg("ll", "ld"))), new BadgeConfiguration("TEST3", "testing", List.of("l", "m", "h", "x", "xx", "xxx"), "SVG", List.of(new BadgeSvg("sl", "sd"), new BadgeSvg("ml", "md"), new BadgeSvg("ll", "ld"))) - ), List.of("TEST1"), Map.of(1L, "TEST1", 2L, "TEST2", 3L, "TEST3")), + ), Map.of(1L, "TEST1", 2L, "TEST2", 3L, "TEST3")), postPolicyGenerator, serverSecretParams, zkProfileOperations, diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcServiceTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcServiceTest.java index 00570e08b..fe90bd993 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcServiceTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcServiceTest.java @@ -174,7 +174,6 @@ public class ProfileGrpcServiceTest extends SimpleBaseGrpcTest