Chore: Migrate REST API - emitTyping to Typescript (#3886)

This commit is contained in:
Reinaldo Neto 2022-03-14 12:55:32 -03:00 committed by GitHub
parent 307ae1295f
commit d18d91dd74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -315,13 +315,6 @@ const RocketChat = {
onStreamData(...args) { onStreamData(...args) {
return sdk.onStreamData(...args); return sdk.onStreamData(...args);
}, },
emitTyping(room, typing = true) {
const { login, settings } = reduxStore.getState();
const { UI_Use_Real_Name } = settings;
const { user } = login;
const name = UI_Use_Real_Name ? user.name : user.username;
return this.methodCall('stream-notify-room', `${room}/typing`, name, typing);
},
toggleFavorite, toggleFavorite,
async getRoomMembers({ rid, allUsers, roomType, type, filter, skip = 0, limit = 10 }) { async getRoomMembers({ rid, allUsers, roomType, type, filter, skip = 0, limit = 10 }) {
const serverVersion = reduxStore.getState().server.version; const serverVersion = reduxStore.getState().server.version;

View File

@ -1,11 +1,19 @@
import sdk from './sdk'; import sdk from './sdk';
import { TEAM_TYPE } from '../../../definitions/ITeam'; import { TEAM_TYPE } from '../../../definitions/ITeam';
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType'; import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
import { SubscriptionType, INotificationPreferences, IRoomNotifications, TRocketChat, IMessage } from '../../../definitions'; import {
SubscriptionType,
INotificationPreferences,
IRoomNotifications,
TRocketChat,
IMessage,
IRoom
} from '../../../definitions';
import { ISpotlight } from '../../../definitions/ISpotlight'; import { ISpotlight } from '../../../definitions/ISpotlight';
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces'; import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
import { Encryption } from '../../encryption'; import { Encryption } from '../../encryption';
import { TParams } from '../../../definitions/ILivechatEditView'; import { TParams } from '../../../definitions/ILivechatEditView';
import { store as reduxStore } from '../../auxStore';
export const createChannel = ({ export const createChannel = ({
name, name,
@ -744,6 +752,14 @@ export const useInviteToken = (token: string): any =>
// @ts-ignore // @ts-ignore
sdk.post('useInviteToken', { token }); sdk.post('useInviteToken', { token });
export const emitTyping = (room: IRoom, typing = true) => {
const { login, settings } = reduxStore.getState();
const { UI_Use_Real_Name } = settings;
const { user } = login;
const name = UI_Use_Real_Name ? user.name : user.username;
return sdk.methodCall('stream-notify-room', `${room}/typing`, name, typing);
};
export function e2eResetOwnKey(this: TRocketChat): Promise<boolean | {}> { export function e2eResetOwnKey(this: TRocketChat): Promise<boolean | {}> {
// {} when TOTP is enabled // {} when TOTP is enabled
// TODO: remove this // TODO: remove this