Skip to content

Commit

Permalink
[FIX] Messages on thread panel were receiving wrong context/subscript…
Browse files Browse the repository at this point in the history
…ion (#14404)
  • Loading branch information
ggazzo committed May 7, 2019
1 parent 7b463af commit aad74af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/threads/client/flextab/thread.js
Expand Up @@ -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: {
Expand Down
3 changes: 2 additions & 1 deletion app/threads/client/flextab/threads.js
Expand Up @@ -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');
Expand Down Expand Up @@ -74,6 +74,7 @@ Template.threads.onCreated(async function() {
thread: msg,
});

this.rid = rid;

this.incLimit = () => {

Expand Down
4 changes: 2 additions & 2 deletions app/ui-utils/client/lib/messageContext.js
Expand Up @@ -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 } }),
Expand All @@ -22,6 +21,7 @@ export function messageContext() {
fields: {
name: 1,
autoTranslate: 1,
rid: 1,
},
}),
settings: {
Expand Down

0 comments on commit aad74af

Please sign in to comment.