From 064659657f430257807041a942267726307e807b Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Fri, 6 Oct 2023 14:31:17 -0700 Subject: [PATCH] Use new endpoint for badge config --- ts/badges/parseBadgesFromServer.ts | 2 +- ts/models/messages.ts | 2 +- ts/textsecure/WebAPI.ts | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ts/badges/parseBadgesFromServer.ts b/ts/badges/parseBadgesFromServer.ts index 73bbfaa295a4..a35c7fd272f3 100644 --- a/ts/badges/parseBadgesFromServer.ts +++ b/ts/badges/parseBadgesFromServer.ts @@ -23,7 +23,7 @@ const badgeFromServerSchema = z.object({ visible: z.boolean().optional(), }); -// GET /v1/subscription/boost/badges +// GET /v1/subscription/configuration const boostBadgesFromServerSchema = z.object({ levels: z.record( z diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 8f992be5c38c..fbda908b96f9 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -2262,7 +2262,7 @@ export class MessageModel extends window.Backbone.Model { if (!messaging) { throw new Error(`${idLog}: messaging is not available`); } - const response = await messaging.server.getBoostBadgesFromServer( + const response = await messaging.server.getSubscriptionConfiguration( userLanguages ); const boostBadgesByLevel = parseBoostBadgeListFromServer( diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 61cdb2eb786c..7c640617a5f3 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -492,7 +492,6 @@ const URL_CALLS = { attachmentId: 'v3/attachments/form/upload', attestation: 'v1/attestation', batchIdentityCheck: 'v1/profile/identity_check/batch', - boostBadges: 'v1/subscription/boost/badges', challenge: 'v1/challenge', config: 'v1/config', deliveryCert: 'v1/certificate/delivery', @@ -525,6 +524,7 @@ const URL_CALLS = { storageRead: 'v1/storage/read', storageToken: 'v1/storage/auth', subscriptions: 'v1/subscription', + subscriptionConfiguration: 'v1/subscription/configuration', supportUnauthenticatedDelivery: 'v1/devices/unauthenticated_delivery', updateDeviceName: 'v1/accounts/name', username: 'v1/accounts/username_hash', @@ -1015,7 +1015,7 @@ export type WebAPIType = { options: GetProfileUnauthOptionsType ) => Promise; getBadgeImageFile: (imageUrl: string) => Promise; - getBoostBadgesFromServer: ( + getSubscriptionConfiguration: ( userLanguages: ReadonlyArray ) => Promise; getProvisioningResource: ( @@ -1388,7 +1388,6 @@ export function initialize({ getAttachment, getAvatar, getBadgeImageFile, - getBoostBadgesFromServer, getConfig, getGroup, getGroupAvatar, @@ -1412,6 +1411,7 @@ export function initialize({ getStorageCredentials, getStorageManifest, getStorageRecords, + getSubscriptionConfiguration, linkDevice, logout, makeProxiedRequest, @@ -1940,11 +1940,11 @@ export function initialize({ ); } - async function getBoostBadgesFromServer( + async function getSubscriptionConfiguration( userLanguages: ReadonlyArray ): Promise { return _ajax({ - call: 'boostBadges', + call: 'subscriptionConfiguration', httpType: 'GET', headers: { 'Accept-Language': formatAcceptLanguageHeader(userLanguages),