From b0a759223d60bbb49f07c4f9428ce34f08035402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 4 Sep 2020 01:06:10 -0400 Subject: [PATCH] feat: add action:user.removeCoverPicture --- src/socket.io/user/profile.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/socket.io/user/profile.js b/src/socket.io/user/profile.js index 4519d46bad..1c2996b389 100644 --- a/src/socket.io/user/profile.js +++ b/src/socket.io/user/profile.js @@ -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) { @@ -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) {