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

30 lines
820 B

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