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/slackbridge/server/removeChannelLinks.js

33 lines
816 B

import { Meteor } from 'meteor/meteor';
import { Rooms } from '../../models/server';
import { hasRole } from '../../authorization/server';
import { settings } from '../../settings/server';
Meteor.methods({
removeSlackBridgeChannelLinks() {
const user = Meteor.user();
if (!user) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'removeSlackBridgeChannelLinks',
});
}
if (!hasRole(user._id, 'admin')) {
throw new Meteor.Error('error-not-authorized', 'Not authorized', {
method: 'removeSlackBridgeChannelLinks',
});
}
if (settings.get('SlackBridge_Enabled') !== true) {
throw new Meteor.Error('SlackBridge_disabled');
}
Rooms.unsetAllImportIds();
return {
message: 'Slackbridge_channel_links_removed_successfully',
params: [],
};
},
});