[FIX] Migrate autoTranslate.translateMessage to REST API (#4029)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
1ce7d5cf6a
commit
a527b320e9
|
@ -291,13 +291,7 @@ const MessageActions = React.memo(
|
|||
});
|
||||
const translatedMessage = getMessageTranslation(message, room.autoTranslateLanguage);
|
||||
if (!translatedMessage) {
|
||||
const m = {
|
||||
_id: message.id,
|
||||
rid: message.subscription ? message.subscription.id : '',
|
||||
u: message.u,
|
||||
msg: message.msg
|
||||
};
|
||||
await Services.translateMessage(m, room.autoTranslateLanguage);
|
||||
await Services.translateMessage(message.id, room.autoTranslateLanguage);
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
export type AutoTranslateEndpoints = {
|
||||
'autotranslate.translateMessage': {
|
||||
POST: (params: { messageId: string; targetLanguage: string }) => void;
|
||||
};
|
||||
};
|
|
@ -19,6 +19,7 @@ import { VideoConferenceEndpoints } from './videoConference';
|
|||
import { CommandsEndpoints } from './commands';
|
||||
import { PushTokenEndpoints } from './pushToken';
|
||||
import { DirectoryEndpoint } from './directory';
|
||||
import { AutoTranslateEndpoints } from './autotranslate';
|
||||
|
||||
export type Endpoints = ChannelsEndpoints &
|
||||
ChatEndpoints &
|
||||
|
@ -40,4 +41,5 @@ export type Endpoints = ChannelsEndpoints &
|
|||
VideoConferenceEndpoints &
|
||||
CommandsEndpoints &
|
||||
PushTokenEndpoints &
|
||||
DirectoryEndpoint;
|
||||
DirectoryEndpoint &
|
||||
AutoTranslateEndpoints;
|
||||
|
|
|
@ -751,8 +751,8 @@ export const saveAutoTranslate = ({
|
|||
export const getSupportedLanguagesAutoTranslate = (): Promise<{ language: string; name: string }[]> =>
|
||||
sdk.methodCallWrapper('autoTranslate.getSupportedLanguages', 'en');
|
||||
|
||||
export const translateMessage = (message: any, targetLanguage: string) =>
|
||||
sdk.methodCallWrapper('autoTranslate.translateMessage', message, targetLanguage);
|
||||
export const translateMessage = (messageId: string, targetLanguage: string) =>
|
||||
sdk.post('autotranslate.translateMessage', { messageId, targetLanguage });
|
||||
|
||||
export const findOrCreateInvite = ({ rid, days, maxUses }: { rid: string; days: number; maxUses: number }): any =>
|
||||
// RC 2.4.0
|
||||
|
|
Loading…
Reference in New Issue