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/webdav/server/methods/removeWebdavAccount.js

25 lines
650 B

import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { WebdavAccounts } from '../../../models';
import { Notifications } from '../../../notifications/server';
Meteor.methods({
removeWebdavAccount(accountId) {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid User', { method: 'removeWebdavAccount' });
}
check(accountId, String);
const removed = WebdavAccounts.removeByUserAndId(accountId, Meteor.userId());
if (removed) {
Notifications.notifyUser(Meteor.userId(), 'webdav', {
type: 'removed',
account: { _id: accountId },
});
}
return removed;
},
});