mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: add action:user.removeCoverPicture
This commit is contained in:
@@ -8,6 +8,7 @@ const events = require('../../events');
|
|||||||
const privileges = require('../../privileges');
|
const privileges = require('../../privileges');
|
||||||
const notifications = require('../../notifications');
|
const notifications = require('../../notifications');
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
const plugins = require('../../plugins');
|
||||||
|
|
||||||
module.exports = function (SocketUser) {
|
module.exports = function (SocketUser) {
|
||||||
SocketUser.changeUsernameEmail = async function (socket, data) {
|
SocketUser.changeUsernameEmail = async function (socket, data) {
|
||||||
@@ -41,7 +42,13 @@ module.exports = function (SocketUser) {
|
|||||||
throw new Error('[[error:no-privileges]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
}
|
}
|
||||||
await user.isAdminOrGlobalModOrSelf(socket.uid, data.uid);
|
await user.isAdminOrGlobalModOrSelf(socket.uid, data.uid);
|
||||||
|
const userData = await user.getUserFields(data.uid, ['cover:url']);
|
||||||
await user.removeCoverPicture(data);
|
await user.removeCoverPicture(data);
|
||||||
|
plugins.fireHook('action:user.removeCoverPicture', {
|
||||||
|
callerUid: socket.uid,
|
||||||
|
uid: data.uid,
|
||||||
|
user: userData,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
async function isPrivilegedOrSelfAndPasswordMatch(socket, data) {
|
async function isPrivilegedOrSelfAndPasswordMatch(socket, data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user