diff --git a/files/assets/js/comments_admin.js b/files/assets/js/comments_admin.js index ff4222c1b..73dd4a613 100644 --- a/files/assets/js/comments_admin.js +++ b/files/assets/js/comments_admin.js @@ -1,75 +1,44 @@ -function removeComment(post_id,button1,button2) { +function removeComment(post_id,button1,button2,cls) { url="/remove_comment/"+post_id post(url) - try { - document.getElementById("comment-"+post_id+"-only").classList.add("banned"); - } catch(e) { - document.getElementById("context").classList.add("banned"); + if (window.location.pathname == '/admin/reported/comments') + { + document.getElementById("post-info-"+post_id).remove() + document.getElementById("comment-"+post_id).remove() } - - var button=document.getElementById("remove-"+post_id); - button.onclick=function(){approveComment(post_id)}; - button.innerHTML='Approve' - - if (typeof button1 !== 'undefined') { - document.getElementById(button1).classList.toggle("d-md-block"); - document.getElementById(button2).classList.toggle("d-md-block"); + else + { + try { + document.getElementById("comment-"+post_id+"-only").classList.add("banned"); + } catch(e) { + document.getElementById("context").classList.add("banned"); + } + document.getElementById(button1).classList.toggle(cls); + document.getElementById(button2).classList.toggle(cls); } }; -function approveComment(post_id,button1,button2) { +function approveComment(post_id,button1,button2,cls) { url="/approve_comment/"+post_id post(url) - try { - document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); - } catch(e) { - document.getElementById("context").classList.remove("banned"); + if (window.location.pathname == '/admin/reported/comments') + { + document.getElementById("post-info-"+post_id).remove() + document.getElementById("comment-"+post_id).remove() } - - var button=document.getElementById("remove-"+post_id); - button.onclick=function(){removeComment(post_id)}; - button.innerHTML='Remove' - - if (typeof button1 !== 'undefined') { - document.getElementById(button1).classList.toggle("d-md-block"); - document.getElementById(button2).classList.toggle("d-md-block"); - } -} - - -function removeComment2(post_id,button1,button2) { - url="/remove_comment/"+post_id - - post(url) - - document.getElementById("comment-"+post_id+"-only").classList.add("banned"); - var button=document.getElementById("remove-"+post_id); - button.onclick=function(){approveComment(post_id)}; - button.innerHTML='Approve' - - if (typeof button1 !== 'undefined') { - document.getElementById(button1).classList.toggle("d-none"); - document.getElementById(button2).classList.toggle("d-none"); - } -}; - -function approveComment2(post_id,button1,button2) { - url="/approve_comment/"+post_id - - post(url) - - document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); - var button=document.getElementById("remove-"+post_id); - button.onclick=function(){removeComment(post_id)}; - button.innerHTML='Remove' - - if (typeof button1 !== 'undefined') { - document.getElementById(button1).classList.toggle("d-none"); - document.getElementById(button2).classList.toggle("d-none"); + else + { + try { + document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); + } catch(e) { + document.getElementById("context").classList.remove("banned"); + } + document.getElementById(button1).classList.toggle(cls); + document.getElementById(button2).classList.toggle(cls); } } diff --git a/files/templates/comments.html b/files/templates/comments.html index e3687899b..1548c566c 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -71,7 +71,7 @@ {% endif %} {% if standalone and level==1 %} -
+
{% if c.post and c.post.over_18 %}+18{% endif %} {% if c.post %} @@ -459,13 +459,8 @@ {% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} -{% if "/reported/" in request.path %} - - -{% else %} - - -{% endif %} + + {% endif %} {% if c.post %} @@ -708,13 +703,8 @@ Unban user {% endif %} {% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} - {% if "/reported/" in request.path %} - Remove - Approve - {% else %} - Remove - Approve - {% endif %} + Remove + Approve {% endif %} {% if c.oauth_app and v.admin_level >= PERMS['APPS_MODERATION'] %}