From 79039c39104bc6558ceb129c994c3ff4cce001ce Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Mon, 28 Feb 2022 16:49:34 -0400 Subject: [PATCH 1/2] migrate conertTeam to ts --- app/definitions/rest/v1/channels.ts | 8 ++++++++ app/definitions/rest/v1/groups.ts | 8 ++++++++ app/lib/rocketchat/services/restApi.ts | 4 +--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index e507d970e2e..8ba4f6ef8db 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -1,3 +1,4 @@ +import { ITeam } from '../../ITeam'; import type { IMessage, IMessageFromServer } from '../../IMessage'; import type { IRoom } from '../../IRoom'; import type { IUser } from '../../IUser'; @@ -28,4 +29,11 @@ export type ChannelsEndpoints = { messages: IMessageFromServer[]; }; }; + 'channels.convertToTeam': { + POST: (params: { channelId: string; channelName: string }) => { + team: ITeam; + success: boolean; + error?: boolean; + }; + }; }; diff --git a/app/definitions/rest/v1/groups.ts b/app/definitions/rest/v1/groups.ts index 8518fcd0503..53c5f0ea550 100644 --- a/app/definitions/rest/v1/groups.ts +++ b/app/definitions/rest/v1/groups.ts @@ -1,3 +1,4 @@ +import { ITeam } from '../../ITeam'; import type { IMessage, IMessageFromServer } from '../../IMessage'; import type { IRoom } from '../../IRoom'; import type { IUser } from '../../IUser'; @@ -22,4 +23,11 @@ export type GroupsEndpoints = { messages: IMessageFromServer[]; }; }; + 'groups.convertToTeam': { + POST: (params: { roomId: string; roomName: string }) => { + team: ITeam; + success: boolean; + error?: string; + }; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index b24129af5f2..af0f033724d 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -220,7 +220,7 @@ export const teamListRoomsOfUser = ({ teamId, userId }: { teamId: string; userId // @ts-ignore sdk.get('teams.listRoomsOfUser', { teamId, userId }); -export const convertChannelToTeam = ({ rid, name, type }: { rid: string; name: string; type: 'c' | 'p' }): any => { +export const convertChannelToTeam = ({ rid, name, type }: { rid: string; name: string; type: 'c' | 'p' }) => { const params = { ...(type === 'c' ? { @@ -232,8 +232,6 @@ export const convertChannelToTeam = ({ rid, name, type }: { rid: string; name: s roomName: name }) }; - // TODO: missing definitions from server - // @ts-ignore return sdk.post(type === 'c' ? 'channels.convertToTeam' : 'groups.convertToTeam', params); }; From d165c79e5b71959cbf9dc17feb66a53cb583c703 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Wed, 2 Mar 2022 13:16:16 -0400 Subject: [PATCH 2/2] remove: params from return on `channels.converToTeam` and `groups.convertToTeam` --- app/definitions/rest/v1/channels.ts | 6 +----- app/definitions/rest/v1/groups.ts | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index 8ba4f6ef8db..d5270e0bc66 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -30,10 +30,6 @@ export type ChannelsEndpoints = { }; }; 'channels.convertToTeam': { - POST: (params: { channelId: string; channelName: string }) => { - team: ITeam; - success: boolean; - error?: boolean; - }; + POST: (params: { channelId: string; channelName: string }) => { team: ITeam }; }; }; diff --git a/app/definitions/rest/v1/groups.ts b/app/definitions/rest/v1/groups.ts index 53c5f0ea550..d858d79d5d3 100644 --- a/app/definitions/rest/v1/groups.ts +++ b/app/definitions/rest/v1/groups.ts @@ -24,10 +24,6 @@ export type GroupsEndpoints = { }; }; 'groups.convertToTeam': { - POST: (params: { roomId: string; roomName: string }) => { - team: ITeam; - success: boolean; - error?: string; - }; + POST: (params: { roomId: string; roomName: string }) => { team: ITeam }; }; };