diff --git a/app/threads/client/flextab/thread.js b/app/threads/client/flextab/thread.js index db96703a4a5a..d4549c1d4bdd 100644 --- a/app/threads/client/flextab/thread.js +++ b/app/threads/client/flextab/thread.js @@ -51,7 +51,7 @@ Template.thread.helpers({ return Threads.find({ tmid }, { sort }); }, messageContext() { - const result = messageContext.apply(this); + const result = messageContext.call(this, { rid: this.mainMessage.rid }); return { ...result, settings: { diff --git a/app/threads/client/flextab/threads.js b/app/threads/client/flextab/threads.js index 4ff0385f3aeb..b9b5e1b5a9a7 100644 --- a/app/threads/client/flextab/threads.js +++ b/app/threads/client/flextab/threads.js @@ -38,7 +38,7 @@ Template.threads.events({ Template.threads.helpers({ subscription() { - return Template.instance().data.subscription; + return Template.currentData().subscription; }, doDotLoadThreads() { return Template.instance().state.get('close'); @@ -74,6 +74,7 @@ Template.threads.onCreated(async function() { thread: msg, }); + this.rid = rid; this.incLimit = () => { diff --git a/app/ui-utils/client/lib/messageContext.js b/app/ui-utils/client/lib/messageContext.js index 2e1ec808ae1d..8ad5a299d451 100644 --- a/app/ui-utils/client/lib/messageContext.js +++ b/app/ui-utils/client/lib/messageContext.js @@ -6,8 +6,7 @@ import { hasPermission } from '../../../authorization/client'; import { settings } from '../../../settings/client'; import { getUserPreference } from '../../../utils/client'; -export function messageContext() { - const { rid } = Template.instance(); +export function messageContext({ rid } = Template.instance()) { const uid = Meteor.userId(); return { u: Users.findOne({ _id: uid }, { fields: { name: 1, username: 1 } }), @@ -22,6 +21,7 @@ export function messageContext() { fields: { name: 1, autoTranslate: 1, + rid: 1, }, }), settings: {