Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Messages on thread panel were receiving wrong context/subscription #14404

Merged
merged 2 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/threads/client/flextab/thread.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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