Skip to content

Commit

Permalink
feat: add action:user.removeCoverPicture
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Sep 4, 2020
1 parent 962446a commit b0a7592
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/socket.io/user/profile.js
Expand Up @@ -8,6 +8,7 @@ const events = require('../../events');
const privileges = require('../../privileges');
const notifications = require('../../notifications');
const db = require('../../database');
const plugins = require('../../plugins');

module.exports = function (SocketUser) {
SocketUser.changeUsernameEmail = async function (socket, data) {
Expand Down Expand Up @@ -41,7 +42,13 @@ module.exports = function (SocketUser) {
throw new Error('[[error:no-privileges]]');
}
await user.isAdminOrGlobalModOrSelf(socket.uid, data.uid);
const userData = await user.getUserFields(data.uid, ['cover:url']);
await user.removeCoverPicture(data);
plugins.fireHook('action:user.removeCoverPicture', {
callerUid: socket.uid,
uid: data.uid,
user: userData,
});
};

async function isPrivilegedOrSelfAndPasswordMatch(socket, data) {
Expand Down

0 comments on commit b0a7592

Please sign in to comment.