mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
closes #5542
This commit is contained in:
@@ -316,7 +316,7 @@ SocketUser.getUserByEmail = function (socket, email, callback) {
|
||||
};
|
||||
|
||||
SocketUser.setModerationNote = function (socket, data, callback) {
|
||||
if (!socket.uid || !data || !data.uid) {
|
||||
if (!socket.uid || !data || !data.uid || !data.note) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
@@ -335,11 +335,13 @@ SocketUser.setModerationNote = function (socket, data, callback) {
|
||||
if (!allowed) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
if (data.note) {
|
||||
user.setUserField(data.uid, 'moderationNote', data.note, next);
|
||||
} else {
|
||||
db.deleteObjectField('user:' + data.uid, 'moderationNote', next);
|
||||
}
|
||||
|
||||
var note = {
|
||||
uid: socket.uid,
|
||||
note: data.note,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
db.sortedSetAdd('uid:' + data.uid + ':moderation:notes', note.timestamp, JSON.stringify(note), next);
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user