[FIX] auto translate cache (#15768)

pull/16183/head
Vigneshwaran Odayappan 6 years ago committed by Guilherme Gazzo
parent 5153115aab
commit 5594793201
No known key found for this signature in database
GPG Key ID: 1F85C9AD922D0829
  1. 2
      app/autotranslate/client/lib/autotranslate.js
  2. 2
      app/autotranslate/client/views/autoTranslateFlexTab.js
  3. 3
      app/ui-utils/client/lib/renderMessageBody.js
  4. 283
      package-lock.json
  5. 1
      package.json

@ -71,7 +71,7 @@ export const AutoTranslate = {
Tracker.autorun(() => {
Subscriptions.find().observeChanges({
changed: (id, fields) => {
if (fields.hasOwnProperty('autoTranslate')) {
if (fields.hasOwnProperty('autoTranslate') || fields.hasOwnProperty('autoTranslateLanguage')) {
mem.clear(this.findSubscriptionByRid);
}
},

@ -99,7 +99,7 @@ Template.autoTranslateFlexTab.onCreated(function() {
this.saveSetting = () => {
const field = this.editing.get();
const subscription = Subscriptions.findOne({ rid: this.rid, 'u._id': Meteor.userId() });
const previousLanguage = subscription.autoTranslateLanguage;
const previousLanguage = subscription && subscription.autoTranslateLanguage;
let value;
switch (field) {
case 'autoTranslate':

@ -1,4 +1,5 @@
import s from 'underscore.string';
import md5 from 'md5';
import { callbacks } from '../../../callbacks';
@ -32,4 +33,4 @@ export const renderMessageBody = mem((message) => {
return (Array.isArray(tokens) ? tokens.reverse() : [])
.reduce((html, { token, text }) => html.replace(token, () => text), html);
}, 500, ({ _id, _updatedAt }) => _id && _updatedAt && _id + _updatedAt);
}, 500, (message) => md5(JSON.stringify(message)));

283
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -90,6 +90,7 @@
"husky": "^1.2.0",
"i18next": "^17.0.17",
"less-loader": "^5.0.0",
"md5": "^2.2.1",
"mocha": "^5.2.0",
"mock-require": "^3.0.2",
"mongo-unit": "^1.4.4",

Loading…
Cancel
Save