Use new endpoint for badge config

This commit is contained in:
ayumi-signal 2023-10-06 14:31:17 -07:00 committed by GitHub
parent 24f17f2cf9
commit 064659657f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -23,7 +23,7 @@ const badgeFromServerSchema = z.object({
visible: z.boolean().optional(), visible: z.boolean().optional(),
}); });
// GET /v1/subscription/boost/badges // GET /v1/subscription/configuration
const boostBadgesFromServerSchema = z.object({ const boostBadgesFromServerSchema = z.object({
levels: z.record( levels: z.record(
z z

View file

@ -2262,7 +2262,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
if (!messaging) { if (!messaging) {
throw new Error(`${idLog}: messaging is not available`); throw new Error(`${idLog}: messaging is not available`);
} }
const response = await messaging.server.getBoostBadgesFromServer( const response = await messaging.server.getSubscriptionConfiguration(
userLanguages userLanguages
); );
const boostBadgesByLevel = parseBoostBadgeListFromServer( const boostBadgesByLevel = parseBoostBadgeListFromServer(

View file

@ -492,7 +492,6 @@ const URL_CALLS = {
attachmentId: 'v3/attachments/form/upload', attachmentId: 'v3/attachments/form/upload',
attestation: 'v1/attestation', attestation: 'v1/attestation',
batchIdentityCheck: 'v1/profile/identity_check/batch', batchIdentityCheck: 'v1/profile/identity_check/batch',
boostBadges: 'v1/subscription/boost/badges',
challenge: 'v1/challenge', challenge: 'v1/challenge',
config: 'v1/config', config: 'v1/config',
deliveryCert: 'v1/certificate/delivery', deliveryCert: 'v1/certificate/delivery',
@ -525,6 +524,7 @@ const URL_CALLS = {
storageRead: 'v1/storage/read', storageRead: 'v1/storage/read',
storageToken: 'v1/storage/auth', storageToken: 'v1/storage/auth',
subscriptions: 'v1/subscription', subscriptions: 'v1/subscription',
subscriptionConfiguration: 'v1/subscription/configuration',
supportUnauthenticatedDelivery: 'v1/devices/unauthenticated_delivery', supportUnauthenticatedDelivery: 'v1/devices/unauthenticated_delivery',
updateDeviceName: 'v1/accounts/name', updateDeviceName: 'v1/accounts/name',
username: 'v1/accounts/username_hash', username: 'v1/accounts/username_hash',
@ -1015,7 +1015,7 @@ export type WebAPIType = {
options: GetProfileUnauthOptionsType options: GetProfileUnauthOptionsType
) => Promise<ProfileType>; ) => Promise<ProfileType>;
getBadgeImageFile: (imageUrl: string) => Promise<Uint8Array>; getBadgeImageFile: (imageUrl: string) => Promise<Uint8Array>;
getBoostBadgesFromServer: ( getSubscriptionConfiguration: (
userLanguages: ReadonlyArray<string> userLanguages: ReadonlyArray<string>
) => Promise<unknown>; ) => Promise<unknown>;
getProvisioningResource: ( getProvisioningResource: (
@ -1388,7 +1388,6 @@ export function initialize({
getAttachment, getAttachment,
getAvatar, getAvatar,
getBadgeImageFile, getBadgeImageFile,
getBoostBadgesFromServer,
getConfig, getConfig,
getGroup, getGroup,
getGroupAvatar, getGroupAvatar,
@ -1412,6 +1411,7 @@ export function initialize({
getStorageCredentials, getStorageCredentials,
getStorageManifest, getStorageManifest,
getStorageRecords, getStorageRecords,
getSubscriptionConfiguration,
linkDevice, linkDevice,
logout, logout,
makeProxiedRequest, makeProxiedRequest,
@ -1940,11 +1940,11 @@ export function initialize({
); );
} }
async function getBoostBadgesFromServer( async function getSubscriptionConfiguration(
userLanguages: ReadonlyArray<string> userLanguages: ReadonlyArray<string>
): Promise<unknown> { ): Promise<unknown> {
return _ajax({ return _ajax({
call: 'boostBadges', call: 'subscriptionConfiguration',
httpType: 'GET', httpType: 'GET',
headers: { headers: {
'Accept-Language': formatAcceptLanguageHeader(userLanguages), 'Accept-Language': formatAcceptLanguageHeader(userLanguages),