diff --git a/app/reactions/client/init.js b/app/reactions/client/init.js index 756557827e6..36dd81338e8 100644 --- a/app/reactions/client/init.js +++ b/app/reactions/client/init.js @@ -10,15 +10,27 @@ import { EmojiPicker } from '../../emoji'; import { tooltip } from '../../ui/client/components/tooltip'; Template.room.events({ - 'click .add-reaction, click [data-message-action="reaction-message"]'(event) { + 'click .add-reaction'(event, instance) { event.preventDefault(); event.stopPropagation(); const data = Blaze.getData(event.currentTarget); - const { msg: { rid, _id: mid } } = messageArgs(data); + const { msg: { rid, _id: mid, private: isPrivate } } = messageArgs(data); const user = Meteor.user(); const room = Rooms.findOne({ _id: rid }); - if (roomTypes.readOnly(room._id, user._id)) { + if (!room) { + return false; + } + + if (!instance.subscription.get()) { + return false; + } + + if (isPrivate) { + return false; + } + + if (roomTypes.readOnly(room._id, user._id) && !room.reactWhenReadOnly) { return false; } diff --git a/app/ui-message/client/message.html b/app/ui-message/client/message.html index 031743f7af0..93663968e85 100644 --- a/app/ui-message/client/message.html +++ b/app/ui-message/client/message.html @@ -218,9 +218,11 @@ {{/each}} -