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/app/channel-settings/server/functions/saveRoomTopic.js

18 lines
571 B

import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { Rooms, Messages } from '../../../models';
export const saveRoomTopic = function (rid, roomTopic, user, sendMessage = true) {
if (!Match.test(rid, String)) {
throw new Meteor.Error('invalid-room', 'Invalid room', {
function: 'RocketChat.saveRoomTopic',
});
}
const update = Rooms.setTopicById(rid, roomTopic);
if (update && sendMessage) {
Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser('room_changed_topic', rid, roomTopic, user);
}
return update;
};