mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
@@ -252,7 +252,8 @@ usersAPI.unban = async function (caller, data) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
|
||||
await user.bans.unban(data.uid);
|
||||
const unbanData = await user.bans.unban(data.uid, data.reason);
|
||||
await db.setObjectField(`uid:${data.uid}:unban:${unbanData.timestamp}`, 'fromUid', caller.uid);
|
||||
|
||||
sockets.in(`uid_${data.uid}`).emit('event:unbanned');
|
||||
|
||||
@@ -283,6 +284,7 @@ usersAPI.mute = async function (caller, data) {
|
||||
const now = Date.now();
|
||||
const muteKey = `uid:${data.uid}:mute:${now}`;
|
||||
const muteData = {
|
||||
type: 'mute',
|
||||
fromUid: caller.uid,
|
||||
uid: data.uid,
|
||||
timestamp: now,
|
||||
@@ -315,7 +317,19 @@ usersAPI.unmute = async function (caller, data) {
|
||||
}
|
||||
|
||||
await db.deleteObjectFields(`user:${data.uid}`, ['mutedUntil', 'mutedReason']);
|
||||
|
||||
const now = Date.now();
|
||||
const unmuteKey = `uid:${data.uid}:unmute:${now}`;
|
||||
const unmuteData = {
|
||||
type: 'unmute',
|
||||
fromUid: caller.uid,
|
||||
uid: data.uid,
|
||||
timestamp: now,
|
||||
};
|
||||
if (data.reason) {
|
||||
unmuteData.reason = data.reason;
|
||||
}
|
||||
await db.sortedSetAdd(`uid:${data.uid}:unmutes:timestamp`, now, unmuteKey);
|
||||
await db.setObject(unmuteKey, unmuteData);
|
||||
await events.log({
|
||||
type: 'user-unmute',
|
||||
uid: caller.uid,
|
||||
|
||||
Reference in New Issue
Block a user