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/threads/client/messageAction/replyInThread.ts

39 lines
1.1 KiB

import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { settings } from '../../../settings/client';
import { MessageAction } from '../../../ui-utils/client';
import { messageArgs } from '../../../../client/lib/utils/messageArgs';
import { roomCoordinator } from '../../../../client/lib/rooms/roomCoordinator';
Meteor.startup(function () {
Tracker.autorun(() => {
if (!settings.get('Threads_enabled')) {
return MessageAction.removeButton('reply-in-thread');
}
MessageAction.addButton({
id: 'reply-in-thread',
icon: 'thread',
label: 'Reply_in_thread',
context: ['message', 'message-mobile'],
action(e, props) {
const { message = messageArgs(this).msg } = props;
e.stopPropagation();
FlowRouter.setParams({
tab: 'thread',
context: message.tmid || message._id,
});
},
condition({ subscription, room }) {
const isLivechatRoom = roomCoordinator.isLivechatRoom(room.t);
if (isLivechatRoom) {
return false;
}
return Boolean(subscription);
},
order: -1,
group: ['message', 'menu'],
});
});
});