Chore: Migrate REST API - removeUserFromRoom to Typescript (#3837)
This commit is contained in:
parent
256bf0eaee
commit
82439159a5
|
@ -52,6 +52,9 @@ export type ChannelsEndpoints = {
|
|||
'channels.convertToTeam': {
|
||||
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
||||
};
|
||||
'channels.kick': {
|
||||
POST: (params: { roomId: string; userId: string }) => {};
|
||||
};
|
||||
'channels.delete': {
|
||||
POST: (params: { roomId: string }) => {};
|
||||
};
|
||||
|
|
|
@ -46,6 +46,9 @@ export type GroupsEndpoints = {
|
|||
'groups.convertToTeam': {
|
||||
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
|
||||
};
|
||||
'groups.kick': {
|
||||
POST: (params: { roomId: string; userId: string }) => {};
|
||||
};
|
||||
'groups.delete': {
|
||||
POST: (params: { roomId: string }) => {};
|
||||
};
|
||||
|
|
|
@ -38,6 +38,9 @@ export type ImEndpoints = {
|
|||
messages: IMessageFromServer[];
|
||||
};
|
||||
};
|
||||
'im.kick': {
|
||||
POST: (params: { roomId: string; userId: string }) => {};
|
||||
};
|
||||
'im.delete': {
|
||||
POST: (params: { roomId: string }) => {};
|
||||
};
|
||||
|
|
|
@ -514,10 +514,8 @@ export const toggleRoomModerator = ({
|
|||
return sdk.post(`${roomTypeToApiType(t)}.removeModerator`, { roomId, userId });
|
||||
};
|
||||
|
||||
export const removeUserFromRoom = ({ roomId, t, userId }: { roomId: string; t: SubscriptionType; userId: string }): any =>
|
||||
export const removeUserFromRoom = ({ roomId, t, userId }: { roomId: string; t: RoomTypes; userId: string }) =>
|
||||
// RC 0.48.0
|
||||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
sdk.post(`${roomTypeToApiType(t)}.kick`, { roomId, userId });
|
||||
|
||||
export const ignoreUser = ({ rid, userId, ignore }: { rid: string; userId: string; ignore: boolean }): any =>
|
||||
|
|
|
@ -28,6 +28,7 @@ import { goRoom, TGoRoomItem } from '../../utils/goRoom';
|
|||
import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
|
||||
import log from '../../utils/log';
|
||||
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
||||
import { RoomTypes } from '../../lib/rocketchat/methods/roomTypeToApiType';
|
||||
import styles from './styles';
|
||||
|
||||
const PAGE_SIZE = 25;
|
||||
|
@ -590,7 +591,8 @@ class RoomMembersView extends React.Component<IRoomMembersViewProps, IRoomMember
|
|||
try {
|
||||
const { room, members, membersFiltered } = this.state;
|
||||
const userId = selectedUser._id;
|
||||
await RocketChat.removeUserFromRoom({ roomId: room.rid, t: room.t, userId });
|
||||
// TODO: interface SubscriptionType on IRoom is wrong
|
||||
await RocketChat.removeUserFromRoom({ roomId: room.rid, t: room.t as RoomTypes, userId });
|
||||
const message = I18n.t('User_has_been_removed_from_s', { s: RocketChat.getRoomTitle(room) });
|
||||
EventEmitter.emit(LISTENER, { message });
|
||||
this.setState({
|
||||
|
|
Loading…
Reference in New Issue