diff --git a/files/assets/js/delete_post_modal.js b/files/assets/js/delete_post_modal.js index 16554f16b..1bf02b2cc 100644 --- a/files/assets/js/delete_post_modal.js +++ b/files/assets/js/delete_post_modal.js @@ -1,13 +1,9 @@ -function delete_postModal(id) { +function delete_postModal(t, id) { document.getElementById("deletePostButton").onclick = function() { - const xhr = createXhrWithFormKey(`/delete_post/${id}`); - xhr[0].onload = function() { - let data - try {data = JSON.parse(xhr[0].response)} - catch(e) {console.log(e)} - success = xhr[0].status >= 200 && xhr[0].status < 300; - showToast(success, getMessageFromJsonData(success, data)); - if (success && data["message"]) { + postToast(t, `/delete_post/${id}`, + { + }, + () => { if (window.location.pathname == '/admin/reported/posts') { document.getElementById("flaggers-"+id).remove() @@ -21,10 +17,7 @@ function delete_postModal(id) { document.getElementById(`delete2-${id}`).classList.add('d-none'); document.getElementById(`undelete2-${id}`).classList.remove('d-none'); } - } else { - showToast(false, getMessageFromJsonData(false, data)); } - }; - xhr[0].send(xhr[1]); + ); }; } diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index ac411b471..94a5cc9ee 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -34,7 +34,7 @@ - + {% endif %} {% if v %} diff --git a/files/templates/post_actions_mobile.html b/files/templates/post_actions_mobile.html index 4c3a4eab6..2810f0238 100644 --- a/files/templates/post_actions_mobile.html +++ b/files/templates/post_actions_mobile.html @@ -41,7 +41,7 @@ - + {% if FEATURES['COUNTRY_CLUB'] -%}