From 4af576668c8cd4603d11a106736f57d75e7038ab Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Wed, 30 Oct 2024 16:44:59 -0400 Subject: [PATCH] Fix incorrect substitution of enumeration key names for capability names --- .../textsecuregcm/controllers/ProfileController.java | 2 +- .../textsecuregcm/controllers/ProfileControllerTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 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 eca7f6f55..0ba41450c 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java @@ -492,6 +492,6 @@ public class ProfileController { private static Map getAccountCapabilities(final Account account) { return Arrays.stream(DeviceCapability.values()) .filter(DeviceCapability::includeInProfile) - .collect(Collectors.toMap(Enum::name, account::hasCapability)); + .collect(Collectors.toMap(DeviceCapability::getName, account::hasCapability)); } } 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 368e9917f..667612f61 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/ProfileControllerTest.java @@ -452,8 +452,8 @@ class ProfileControllerTest { .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD)) .get(BaseProfileResponse.class); - assertEquals(isDeleteSyncSupported, profile.getCapabilities().get(DeviceCapability.DELETE_SYNC.name())); - assertEquals(isVersionedExpirationTimerSupported, profile.getCapabilities().get(DeviceCapability.VERSIONED_EXPIRATION_TIMER.name())); + assertEquals(isDeleteSyncSupported, profile.getCapabilities().get("deleteSync")); + assertEquals(isVersionedExpirationTimerSupported, profile.getCapabilities().get("versionedExpirationTimer")); } @Test