Chore: Migrate REST API - editMessage to Typescript (#3887)
* Chore: Migrate REST API - editMessage to Typescript * minor tweak
This commit is contained in:
parent
654e3c226e
commit
6ff2fc37d0
|
@ -65,6 +65,11 @@ export type ChatEndpoints = {
|
|||
messages: IMessageFromServer[];
|
||||
};
|
||||
};
|
||||
'chat.update': {
|
||||
POST: (params: { roomId: IServerRoom['_id']; msgId: string; text: string }) => {
|
||||
messages: IMessageFromServer;
|
||||
};
|
||||
};
|
||||
'chat.getMessageReadReceipts': {
|
||||
GET: (params: { messageId: string }) => { receipts: IReadReceipts[] };
|
||||
};
|
||||
|
|
|
@ -11,8 +11,6 @@ import { getBundleId, isIOS } from '../../utils/deviceInfo';
|
|||
import log from '../../utils/log';
|
||||
import SSLPinning from '../../utils/sslPinning';
|
||||
import database from '../database';
|
||||
import { sanitizeLikeString } from '../database/utils';
|
||||
import { Encryption } from '../encryption';
|
||||
import triggerBlockAction, { triggerCancel, triggerSubmitView } from '../methods/actions';
|
||||
import callJitsi, { callJitsiWithoutServer } from '../methods/callJitsi';
|
||||
import canOpenRoom from '../methods/canOpenRoom';
|
||||
|
@ -298,11 +296,6 @@ const RocketChat = {
|
|||
return setting;
|
||||
});
|
||||
},
|
||||
async editMessage(message) {
|
||||
const { rid, msg } = await Encryption.encryptMessage(message);
|
||||
// RC 0.49.0
|
||||
return this.post('chat.update', { roomId: rid, msgId: message.id, text: msg });
|
||||
},
|
||||
getRoom,
|
||||
getPermalinkMessage,
|
||||
getPermalinkChannel(channel) {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import sdk from './sdk';
|
||||
import { TEAM_TYPE } from '../../../definitions/ITeam';
|
||||
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
|
||||
import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions';
|
||||
import { SubscriptionType, INotificationPreferences, IRoomNotifications, IMessage } from '../../../definitions';
|
||||
import { ISpotlight } from '../../../definitions/ISpotlight';
|
||||
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
|
||||
import { Encryption } from '../../encryption';
|
||||
import { TParams } from '../../../definitions/ILivechatEditView';
|
||||
|
||||
export const createChannel = ({
|
||||
|
@ -742,3 +743,9 @@ export const useInviteToken = (token: string): any =>
|
|||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
sdk.post('useInviteToken', { token });
|
||||
|
||||
export const editMessage = async (message: IMessage) => {
|
||||
const { rid, msg } = await Encryption.encryptMessage(message);
|
||||
// RC 0.49.0
|
||||
return sdk.post('chat.update', { roomId: rid, msgId: message.id, text: msg });
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue