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/packages/rocketchat-slashcommands-topic/topic.js

31 lines
854 B

import { Meteor } from 'meteor/meteor';
/*
* Join is a named function that will replace /topic commands
* @param {Object} message - The message object
*/
function Topic(command, params, item) {
if (command === 'topic') {
if ((Meteor.isClient && RocketChat.authz.hasPermission('edit-room', item.rid)) || (Meteor.isServer && RocketChat.authz.hasPermission(Meteor.userId(), 'edit-room', item.rid))) {
Meteor.call('saveRoomSettings', item.rid, 'roomTopic', params, (err) => {
if (err) {
if (Meteor.isClient) {
return handleError(err);
} else {
throw err;
}
}
if (Meteor.isClient) {
RocketChat.callbacks.run('roomTopicChanged', ChatRoom.findOne(item.rid));
}
});
}
}
}
RocketChat.slashCommands.add('topic', Topic, {
description: 'Slash_Topic_Description',
params: 'Slash_Topic_Params',
});