mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Improvements to shadow muting (#15543)
* fix test wording * make shadow mute work for dms * shadow mute chat messages * shadow mute invites * oops * refactor mute handling into middleware * correctly throw error * fix * test(chat): expect errors when muted Also fixes the Linux version in the mongo commands. Again. wtf --------- Co-authored-by: Kalista Payne <kalista@habitica.com>
This commit is contained in:
@@ -145,3 +145,15 @@ export function authWithSession (req, res, next) {
|
||||
})
|
||||
.catch(next);
|
||||
}
|
||||
|
||||
export function chatPrivilegesRequired () {
|
||||
return function chatPrivilegesRequiredHandler (req, res, next) {
|
||||
const { user } = res.locals;
|
||||
|
||||
if (user.flags.chatRevoked) {
|
||||
throw new NotAuthorized(res.t('chatPrivilegesRevoked'));
|
||||
}
|
||||
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user