fix: Client check `AutoTranslate_Enabled` setting before a server endpoint call (#32221)

pull/32084/head^2
Tiago Evangelista Pinto 2 years ago committed by GitHub
parent 6b053aedb0
commit 1b390c7282
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/strange-comics-camp.md
  2. 3
      apps/meteor/app/autotranslate/client/lib/autotranslate.ts

@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---
Fixed an issue where an endpoint was called before checking configuration that enables automatic translation when launching the application

@ -17,6 +17,7 @@ import {
} from '../../../../client/views/room/MessageList/lib/autoTranslate';
import { hasPermission } from '../../../authorization/client';
import { Subscriptions, Messages } from '../../../models/client';
import { settings } from '../../../settings/client';
import { sdk } from '../../../utils/client/lib/SDKClient';
let userLanguage = 'en';
@ -102,7 +103,7 @@ export const AutoTranslate = {
Tracker.autorun(async (c) => {
const uid = Meteor.userId();
if (!uid || !hasPermission('auto-translate')) {
if (!settings.get('AutoTranslate_Enabled') || !uid || !hasPermission('auto-translate')) {
return;
}

Loading…
Cancel
Save