From 75596eaa96ef612bb7481decec794b9bc8c0ecb2 Mon Sep 17 00:00:00 2001 From: fatchan Date: Sat, 9 Nov 2019 21:14:58 +1100 Subject: [PATCH] names of staff hidden by default with checkbxo to optionalyl show name --- configs/main.json.example | 3 ++- models/forms/actionhandler.js | 8 +++++++- views/includes/actionfooter.pug | 3 +++ views/includes/actionfooter_globalmanage.pug | 3 +++ views/includes/actionfooter_manage.pug | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configs/main.json.example b/configs/main.json.example index f0d2a199..673a4d47 100644 --- a/configs/main.json.example +++ b/configs/main.json.example @@ -111,7 +111,8 @@ "allowedFileTypes": { "animatedImage": true, "image": true, - "video": true + "video": true, + "audio": true } } } diff --git a/models/forms/actionhandler.js b/models/forms/actionhandler.js index c4ed9e62..d36f8bc4 100644 --- a/models/forms/actionhandler.js +++ b/models/forms/actionhandler.js @@ -250,16 +250,22 @@ module.exports = async (req, res, next) => { const modlog = {}; const logDate = new Date(); //all events current date const message = req.body.log_message || null; + let logUser; + if (res.locals.permLevel < 4) { //if staff + logUser = req.session.user.username; + } else { + logUser = 'Unregistered User'; + } for (let i = 0; i < res.locals.posts.length; i++) { const post = res.locals.posts[i]; if (!modlog[post.board]) { //per board actions, all actions combined to one event - const logUser = res.locals.permLevel < 4 ? req.session.user.username : 'Unregistered User' modlog[post.board] = { postIds: [], actions: modlogActions, date: logDate, user: logUser, + showUser: req.body.show_name || logUser === 'Unregistered User' ? true : false, message: message, }; } diff --git a/views/includes/actionfooter.pug b/views/includes/actionfooter.pug index 648376f7..19bdaf66 100644 --- a/views/includes/actionfooter.pug +++ b/views/includes/actionfooter.pug @@ -51,6 +51,9 @@ details.toggle-label label input.post-check(type='checkbox', name='preserve_post' value='1') | Show Post In Ban + label + input.post-check(type='checkbox', name='show_name' value='1') + | Show Username In Modlog label input(type='text', name='ban_reason', placeholder='ban reason' autocomplete='off') label diff --git a/views/includes/actionfooter_globalmanage.pug b/views/includes/actionfooter_globalmanage.pug index 5e8a38c6..f25b6148 100644 --- a/views/includes/actionfooter_globalmanage.pug +++ b/views/includes/actionfooter_globalmanage.pug @@ -35,6 +35,9 @@ details.toggle-label label input.post-check(type='checkbox', name='preserve_post' value='1') | Show Post In Ban + label + input.post-check(type='checkbox', name='show_name' value='1') + | Show Username In Modlog label input(type='text', name='ban_reason', placeholder='ban reason' autocomplete='off') label diff --git a/views/includes/actionfooter_manage.pug b/views/includes/actionfooter_manage.pug index 97ce28b6..644d7ceb 100644 --- a/views/includes/actionfooter_manage.pug +++ b/views/includes/actionfooter_manage.pug @@ -46,6 +46,9 @@ details.toggle-label label input.post-check(type='checkbox', name='preserve_post' value='1') | Show Post In Ban + label + input.post-check(type='checkbox', name='show_name' value='1') + | Show Username In Modlog label input(type='text', name='ban_reason', placeholder='ban reason' autocomplete='off') label