Skip to content

Commit

Permalink
Regression: Prevent Message Attachment rendering (#20860)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored and sampaiodiego committed Feb 28, 2021
1 parent f4c6225 commit 232c6e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion app/ui-utils/client/lib/Layout.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { ReactiveVar } from 'meteor/reactive-var';

export const Layout = new class RocketChatLayout {
constructor() {
this.embedded = new ReactiveVar();
Tracker.autorun(() => {
this.layout = FlowRouter.getQueryParam('layout');
this.embedded.set(this.layout === 'embedded');
});
}

isEmbedded() {
return FlowRouter.getQueryParam('layout') === 'embedded';
return this.embedded.get();
}
}();
10 changes: 5 additions & 5 deletions app/ui-utils/client/lib/messageContext.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Tracker } from 'meteor/tracker';

import { Subscriptions, Rooms, Users } from '../../../models/client';
import { hasPermission } from '../../../authorization/client';
Expand All @@ -17,7 +18,7 @@ const fields = { name: 1, username: 1, 'settings.preferences.showMessageInMainTh
export function messageContext({ rid } = Template.instance()) {
const uid = Meteor.userId();
const user = Users.findOne({ _id: uid }, { fields }) || {};
const instace = Template.instance();
const instance = Template.instance();
const openThread = (e) => {
const { rid, mid, tmid } = e.currentTarget.dataset;
const room = Rooms.findOne({ _id: rid });
Expand All @@ -40,7 +41,7 @@ export function messageContext({ rid } = Template.instance()) {
});
} : (msg, e) => {
const { actionlink } = e.currentTarget.dataset;
actionLinks.run(actionlink, msg._id, instace, (err) => {
actionLinks.run(actionlink, msg._id, instance, (err) => {
if (err) {
handleError(err);
}
Expand All @@ -60,13 +61,12 @@ export function messageContext({ rid } = Template.instance()) {

return {
u: user,
room: Rooms.findOne({ _id: rid }, {
reactive: false,
room: Tracker.nonreactive(() => Rooms.findOne({ _id: rid }, {
fields: {
_updatedAt: 0,
lastMessage: 0,
},
}),
})),
subscription: Subscriptions.findOne({ rid }, {
fields: {
name: 1,
Expand Down

0 comments on commit 232c6e1

Please sign in to comment.