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] Prevent Message Attachment rendering #20860

Merged
merged 1 commit into from
Feb 22, 2021
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
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