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.ts

29 lines
689 B

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