From 2d0879ec3ee6b7d4b869b2cb3cb3956d40d7f249 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 24 Oct 2022 22:38:54 +0200 Subject: [PATCH] allow admins to unmute users from modmail --- files/assets/js/comments_admin.js | 5 +++-- files/templates/comments.html | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/assets/js/comments_admin.js b/files/assets/js/comments_admin.js index 1841a3868..65ebb0410 100644 --- a/files/assets/js/comments_admin.js +++ b/files/assets/js/comments_admin.js @@ -38,7 +38,7 @@ function approveComment(t,post_id,button1,button2,cls) { } } -function adminMuteUser(userId, muteStatus, buttonId) { +function adminToggleMute(userId, muteStatus, buttonId) { const xhr = createXhrWithFormKey(`/mute_user/${userId}/${muteStatus}`); xhr[0].onload = function() { let data @@ -48,5 +48,6 @@ function adminMuteUser(userId, muteStatus, buttonId) { showToast(success, getMessageFromJsonData(success, data)); }; xhr[0].send(xhr[1]); - document.getElementById('mute-user-' + buttonId).classList.add("d-none"); + document.getElementById('mute-user-' + buttonId).classList.toggle("d-none"); + document.getElementById('unmute-user-' + buttonId).classList.toggle("d-none"); } diff --git a/files/templates/comments.html b/files/templates/comments.html index 2cc6db04c..99f7b042f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -561,8 +561,9 @@ {% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %} - {% if (v and v.admin_level >= PERMS['USER_BAN']) and (c.sentto == 2) and not c.author.is_muted %} - Mute + {% if (v and v.admin_level >= PERMS['USER_BAN']) and (c.sentto == 2) %} + Mute + Unmute {% endif %} Reply