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 bf42c103f..e1ef5b22a 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserCapabilities.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserCapabilities.java @@ -5,40 +5,14 @@ package org.whispersystems.textsecuregcm.entities; -import com.fasterxml.jackson.annotation.JsonProperty; import org.whispersystems.textsecuregcm.storage.Account; public record UserCapabilities( - @Deprecated(forRemoval = true) - @JsonProperty("gv1-migration") - boolean gv1Migration, - - @Deprecated(forRemoval = true) - boolean senderKey, - - @Deprecated(forRemoval = true) - boolean announcementGroup, - - @Deprecated(forRemoval = true) - boolean changeNumber, - - @Deprecated(forRemoval = true) - boolean stories, - - @Deprecated(forRemoval = true) - boolean giftBadges, boolean paymentActivation, boolean pni) { public static UserCapabilities createForAccount(Account account) { return new UserCapabilities( - true, - true, - true, - true, - true, - true, - account.isPaymentActivationSupported(), // Although originally intended to indicate that clients support phone number identifiers, the scope of this 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 617666b5c..48c7533cf 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java @@ -200,12 +200,15 @@ class ProfileControllerTest { when(profileAccount.getCurrentProfileVersion()).thenReturn(Optional.empty()); when(profileAccount.getUsernameHash()).thenReturn(Optional.of(USERNAME_HASH)); when(profileAccount.getUnidentifiedAccessKey()).thenReturn(Optional.of(UNIDENTIFIED_ACCESS_KEY)); + when(profileAccount.isPniSupported()).thenReturn(true); Account capabilitiesAccount = mock(Account.class); when(capabilitiesAccount.getUuid()).thenReturn(AuthHelper.VALID_UUID); when(capabilitiesAccount.getIdentityKey(IdentityType.ACI)).thenReturn(ACCOUNT_IDENTITY_KEY); when(capabilitiesAccount.getIdentityKey(IdentityType.PNI)).thenReturn(ACCOUNT_PHONE_NUMBER_IDENTITY_KEY); + when(capabilitiesAccount.isPniSupported()).thenReturn(true); + when(capabilitiesAccount.isPaymentActivationSupported()).thenReturn(false); when(capabilitiesAccount.isEnabled()).thenReturn(true); when(accountsManager.getByServiceIdentifier(any())).thenReturn(Optional.empty()); @@ -389,9 +392,8 @@ class ProfileControllerTest { .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD)) .get(BaseProfileResponse.class); - assertThat(profile.getCapabilities().gv1Migration()).isTrue(); - assertThat(profile.getCapabilities().senderKey()).isTrue(); - assertThat(profile.getCapabilities().announcementGroup()).isTrue(); + assertThat(profile.getCapabilities().pni()).isTrue(); + assertThat(profile.getCapabilities().paymentActivation()).isFalse(); } @Test @@ -874,7 +876,7 @@ class ProfileControllerTest { assertThat(profile.getAboutEmoji()).containsExactly(emoji); assertThat(profile.getAvatar()).isEqualTo("profiles/validavatar"); assertThat(profile.getPhoneNumberSharing()).containsExactly(phoneNumberSharing); - assertThat(profile.getBaseProfileResponse().getCapabilities().gv1Migration()).isTrue(); + assertThat(profile.getBaseProfileResponse().getCapabilities().pni()).isTrue(); assertThat(profile.getBaseProfileResponse().getUuid()).isEqualTo(new AciServiceIdentifier(AuthHelper.VALID_UUID_TWO)); assertThat(profile.getBaseProfileResponse().getBadges()).hasSize(1).element(0).has(new Condition<>( badge -> "Test Badge".equals(badge.getName()), "has badge with expected name"));