The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/reactions/client/init.js

45 lines
1.2 KiB

import { Meteor } from 'meteor/meteor';
import { MessageAction } from '../../ui-utils/client';
import { messageArgs } from '../../../client/lib/utils/messageArgs';
import { roomCoordinator } from '../../../client/lib/rooms/roomCoordinator';
import { sdk } from '../../utils/client/lib/SDKClient';
Meteor.startup(function () {
MessageAction.addButton({
id: 'reaction-message',
icon: 'add-reaction',
label: 'Add_Reaction',
context: ['message', 'message-mobile', 'threads', 'federated'],
action(event, props) {
event.stopPropagation();
const { message = messageArgs(this).msg, chat } = props;
chat?.emojiPicker.open(event.currentTarget, (emoji) => sdk.call('setReaction', `:${emoji}:`, message._id));
},
condition({ message, user, room, subscription }) {
if (!room) {
return false;
}
if (!subscription) {
return false;
}
if (message.private) {
return false;
}
if (roomCoordinator.readOnly(room._id, user) && !room.reactWhenReadOnly) {
return false;
}
const isLivechatRoom = roomCoordinator.isLivechatRoom(room.t);
if (isLivechatRoom) {
return false;
}
return true;
},
order: -2,
group: ['message', 'menu'],
});
});