Chore: Migrate REST API - addUsersToRoom to Typescript (#3884)

* Chore: Migrate REST API - addUsersToRoom to Typescript

* Update app/lib/rocketchat/services/restApi.ts

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>

* minor tweak

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Reinaldo Neto 2022-03-14 21:29:48 -03:00 committed by GitHub
parent db5c7d94aa
commit de8a7f1ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -377,12 +377,6 @@ const RocketChat = {
// RC 3.1.0
return this.post('users.2fa.sendEmailCode', { emailOrUsername: username });
},
addUsersToRoom(rid) {
let { users } = reduxStore.getState().selectedUsers;
users = users.map(u => u.name);
// RC 0.51.0
return this.methodCallWrapper('addUsersToRoom', { rid, users });
},
hasRole(role) {
const shareUser = reduxStore.getState().share.user;
const loginUser = reduxStore.getState().login.user;

View File

@ -753,6 +753,13 @@ export const useInviteToken = (token: string): any =>
// @ts-ignore
sdk.post('useInviteToken', { token });
export const addUsersToRoom = (rid: string): Promise<boolean> => {
const { users: selectedUsers } = reduxStore.getState().selectedUsers;
const users = selectedUsers.map(u => u.name);
// RC 0.51.0
return sdk.methodCallWrapper('addUsersToRoom', { rid, users });
};
export const emitTyping = (room: IRoom, typing = true) => {
const { login, settings } = reduxStore.getState();
const { UI_Use_Real_Name } = settings;