From c72b524ac068cf0846d052832465525363524998 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Mon, 7 Mar 2022 11:47:06 -0300 Subject: [PATCH] chore: add rest api return (#3849) --- app/definitions/rest/v1/channels.ts | 6 ++++++ app/lib/rocketchat/services/restApi.ts | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index 071734b1d..2b5dd5f25 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -64,4 +64,10 @@ export type ChannelsEndpoints = { 'channels.leave': { POST: (params: { roomId: string }) => {}; }; + 'channels.addModerator': { + POST: (params: { roomId: string; userId: string }) => {}; + }; + 'channels.removeModerator': { + POST: (params: { roomId: string; userId: string }) => {}; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 4130dd7d7..c838bcd8d 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -501,17 +501,14 @@ export const toggleRoomModerator = ({ t: SubscriptionType; userId: string; isModerator: boolean; -}): any => { +}) => { + const type = t as SubscriptionType.CHANNEL; if (isModerator) { // RC 0.49.4 - // TODO: missing definitions from server - // @ts-ignore - return sdk.post(`${roomTypeToApiType(t)}.addModerator`, { roomId, userId }); + return sdk.post(`${roomTypeToApiType(type)}.addModerator`, { roomId, userId }); } // RC 0.49.4 - // TODO: missing definitions from server - // @ts-ignore - return sdk.post(`${roomTypeToApiType(t)}.removeModerator`, { roomId, userId }); + return sdk.post(`${roomTypeToApiType(type)}.removeModerator`, { roomId, userId }); }; export const removeUserFromRoom = ({ roomId, t, userId }: { roomId: string; t: RoomTypes; userId: string }) =>