From 8c55f39cdf5528fa3f1d4768443fe742da4d2368 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Sun, 18 Feb 2024 19:48:33 -0500 Subject: [PATCH] Revert "Use a phased enrollment strategy for the `pnp` compatibility flag" This reverts commit 3e12a8780de6650474e359a3289bb0e4a82aab9d. --- .../textsecuregcm/WhisperServerService.java | 1 - .../controllers/ProfileController.java | 39 ++++++++----------- .../entities/UserCapabilities.java | 4 +- .../textsecuregcm/grpc/ProfileGrpcHelper.java | 2 +- .../controllers/ProfileControllerTest.java | 2 - .../grpc/ProfileAnonymousGrpcServiceTest.java | 2 +- .../grpc/ProfileGrpcServiceTest.java | 2 +- 7 files changed, 21 insertions(+), 31 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java index 53b1bdd9b..1ed735242 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java @@ -901,7 +901,6 @@ public class WhisperServerService extends Application dynamicConfigurationManager; - private final ExperimentEnrollmentManager experimentEnrollmentManager; private final ProfileBadgeConverter profileBadgeConverter; private final Map badgeConfigurationMap; @@ -131,29 +129,26 @@ public class ProfileController { private static final Counter VERSION_NOT_FOUND_COUNTER = Metrics.counter(name(ProfileController.class, "versionNotFound")); private static final String INVALID_ACCEPT_LANGUAGE_COUNTER_NAME = name(ProfileController.class, "invalidAcceptLanguage"); - private static final String PNP_FLAG_EXPERIMENT_NAME = "pnpCompatibilityFlag"; - public ProfileController( - Clock clock, - RateLimiters rateLimiters, - AccountsManager accountsManager, - ProfilesManager profilesManager, - DynamicConfigurationManager dynamicConfigurationManager, ExperimentEnrollmentManager experimentEnrollmentManager, - ProfileBadgeConverter profileBadgeConverter, - BadgesConfiguration badgesConfiguration, - S3Client s3client, - PostPolicyGenerator policyGenerator, - PolicySigner policySigner, - String bucket, - ServerZkProfileOperations zkProfileOperations, - Executor batchIdentityCheckExecutor) { + Clock clock, + RateLimiters rateLimiters, + AccountsManager accountsManager, + ProfilesManager profilesManager, + DynamicConfigurationManager dynamicConfigurationManager, + ProfileBadgeConverter profileBadgeConverter, + BadgesConfiguration badgesConfiguration, + S3Client s3client, + PostPolicyGenerator policyGenerator, + PolicySigner policySigner, + String bucket, + ServerZkProfileOperations zkProfileOperations, + Executor batchIdentityCheckExecutor) { this.clock = clock; this.rateLimiters = rateLimiters; this.accountsManager = accountsManager; this.profilesManager = profilesManager; this.dynamicConfigurationManager = dynamicConfigurationManager; - this.experimentEnrollmentManager = experimentEnrollmentManager; - this.profileBadgeConverter = profileBadgeConverter; + this.profileBadgeConverter = profileBadgeConverter; this.badgeConfigurationMap = badgesConfiguration.getBadges().stream().collect(Collectors.toMap( BadgeConfiguration::getId, Function.identity())); this.zkProfileOperations = zkProfileOperations; @@ -442,8 +437,7 @@ public class ProfileController { return new BaseProfileResponse(account.getIdentityKey(IdentityType.ACI), account.getUnidentifiedAccessKey().map(UnidentifiedAccessChecksum::generateFor).orElse(null), account.isUnrestrictedUnidentifiedAccess(), - UserCapabilities.createForAccount(account, - experimentEnrollmentManager.isEnrolled(account.getIdentifier(IdentityType.ACI), PNP_FLAG_EXPERIMENT_NAME)), + UserCapabilities.createForAccount(account), profileBadgeConverter.convert( getAcceptableLanguagesForRequest(containerRequestContext), account.getBadges(), @@ -455,8 +449,7 @@ public class ProfileController { return new BaseProfileResponse(account.getIdentityKey(IdentityType.PNI), null, false, - UserCapabilities.createForAccount(account, - experimentEnrollmentManager.isEnrolled(account.getIdentifier(IdentityType.ACI), PNP_FLAG_EXPERIMENT_NAME)), + UserCapabilities.createForAccount(account), Collections.emptyList(), new PniServiceIdentifier(account.getPhoneNumberIdentifier())); } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserCapabilities.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserCapabilities.java index 378055b61..682d1524b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserCapabilities.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserCapabilities.java @@ -12,7 +12,7 @@ public record UserCapabilities(boolean paymentActivation, boolean pni, boolean pnp) { - public static UserCapabilities createForAccount(final Account account, final boolean includePnpFlag) { - return new UserCapabilities(account.isPaymentActivationSupported(), true, includePnpFlag); + public static UserCapabilities createForAccount(final Account account) { + return new UserCapabilities(account.isPaymentActivationSupported(), true, true); } } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcHelper.java b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcHelper.java index 5331e4b67..4469556a2 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcHelper.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/ProfileGrpcHelper.java @@ -105,7 +105,7 @@ public class ProfileGrpcHelper { final ProfileBadgeConverter profileBadgeConverter) { final GetUnversionedProfileResponse.Builder responseBuilder = GetUnversionedProfileResponse.newBuilder() .setIdentityKey(ByteString.copyFrom(targetAccount.getIdentityKey(targetIdentifier.identityType()).serialize())) - .setCapabilities(buildUserCapabilities(org.whispersystems.textsecuregcm.entities.UserCapabilities.createForAccount(targetAccount, true))); + .setCapabilities(buildUserCapabilities(org.whispersystems.textsecuregcm.entities.UserCapabilities.createForAccount(targetAccount))); switch (targetIdentifier.identityType()) { case ACI -> { 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 fe263678b..507806228 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java @@ -88,7 +88,6 @@ import org.whispersystems.textsecuregcm.entities.CreateProfileRequest; import org.whispersystems.textsecuregcm.entities.ExpiringProfileKeyCredentialProfileResponse; import org.whispersystems.textsecuregcm.entities.ProfileAvatarUploadAttributes; import org.whispersystems.textsecuregcm.entities.VersionedProfileResponse; -import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager; import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier; import org.whispersystems.textsecuregcm.identity.IdentityType; import org.whispersystems.textsecuregcm.identity.PniServiceIdentifier; @@ -158,7 +157,6 @@ class ProfileControllerTest { accountsManager, profilesManager, dynamicConfigurationManager, - mock(ExperimentEnrollmentManager.class), (acceptableLanguages, accountBadges, isSelf) -> List.of(new Badge("TEST", "other", "Test Badge", "This badge is in unit tests.", List.of("l", "m", "h", "x", "xx", "xxx"), "SVG", List.of(new BadgeSvg("sl", "sd"), new BadgeSvg("ml", "md"), new BadgeSvg("ll", "ld"))) ), diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileAnonymousGrpcServiceTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileAnonymousGrpcServiceTest.java index 33fe59cc7..c6f0e2abf 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileAnonymousGrpcServiceTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/ProfileAnonymousGrpcServiceTest.java @@ -162,7 +162,7 @@ public class ProfileAnonymousGrpcServiceTest extends SimpleBaseGrpcTest