From 2ba1a1e86e62375960ffbfd43810ee30232cf0ec Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 30 Oct 2022 17:10:07 +0200 Subject: [PATCH] remove postToast compatability function --- files/assets/js/award_modal.js | 2 +- files/assets/js/comments_admin.js | 4 +- files/assets/js/core.js | 7 +- files/assets/js/followers.js | 2 +- files/assets/js/following.js | 2 +- files/assets/js/pinpost.js | 2 +- files/assets/js/submission_admin.js | 4 +- files/assets/js/userpage_v.js | 4 +- files/classes/submission.py | 2 +- files/templates/admin/admin_home.html | 18 ++--- files/templates/admin/app.html | 6 +- files/templates/admin/apps.html | 6 +- files/templates/admin/banned_domains.html | 2 +- files/templates/comments.html | 70 +++++++++---------- files/templates/hats.html | 8 +-- files/templates/header.html | 4 +- files/templates/home.html | 12 ++-- files/templates/notifications.html | 2 +- files/templates/post_actions.html | 44 ++++++------ files/templates/post_actions_mobile.html | 36 +++++----- .../templates/post_admin_actions_mobile.html | 16 ++--- files/templates/settings_apps.html | 4 +- files/templates/settings_blocks.html | 2 +- files/templates/settings_filters.html | 30 ++++---- files/templates/settings_profile.html | 16 ++--- files/templates/settings_security.html | 6 +- files/templates/shop.html | 4 +- files/templates/sub/settings.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 2 +- files/templates/submit_hats.html | 4 +- files/templates/submit_marseys.html | 4 +- files/templates/user_listing.html | 4 +- files/templates/userpage.html | 16 ++--- files/templates/userpage_admintools.html | 16 ++--- files/templates/userpage_blocking.html | 2 +- 36 files changed, 181 insertions(+), 186 deletions(-) diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index 1d7438e0a..dc2ddd0a4 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -153,7 +153,7 @@ function buy(mb) { function giveaward(t) { const kind = document.getElementById('kind').value; - post_toast_callback(t.dataset.action, + postToast_callback(t.dataset.action, { "kind": kind, "note": document.getElementById('note').value diff --git a/files/assets/js/comments_admin.js b/files/assets/js/comments_admin.js index 65ebb0410..af748e673 100644 --- a/files/assets/js/comments_admin.js +++ b/files/assets/js/comments_admin.js @@ -1,7 +1,7 @@ function removeComment(t,post_id,button1,button2,cls) { url="/remove_comment/"+post_id - post_toast(t,url,button1,button2,cls) + postToast(t,url,button1,button2,cls) if (window.location.pathname == '/admin/reported/comments') { @@ -21,7 +21,7 @@ function removeComment(t,post_id,button1,button2,cls) { function approveComment(t,post_id,button1,button2,cls) { url="/approve_comment/"+post_id - post_toast(t,url,button1,button2,cls) + postToast(t,url,button1,button2,cls) if (window.location.pathname == '/admin/reported/comments') { diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 5da577d9d..01db5fee5 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -93,12 +93,7 @@ function postToast(t, url, button1, button2, className, extraActions, extraActio xhr[0].send(xhr[1]); } -/* temporary compatability function. js styling wants us to use thisCase so any new things should use that */ -function post_toast(t, url, button1, button2, classname, extra_actions, extra_actions_error) { - postToast(t, url, button1, button2, classname, extra_actions, extra_actions_error); -} - -function post_toast_callback(url, data, callback) { +function postToast_callback(url, data, callback) { let form = new FormData(); if(typeof data === 'object' && data !== null) { for(let k of Object.keys(data)) { diff --git a/files/assets/js/followers.js b/files/assets/js/followers.js index d237e5905..9f10ade66 100644 --- a/files/assets/js/followers.js +++ b/files/assets/js/followers.js @@ -1,4 +1,4 @@ function removeFollower(t, username) { - post_toast(t,'/remove_follow/' + username); + postToast(t,'/remove_follow/' + username); t.parentElement.parentElement.remove(); } diff --git a/files/assets/js/following.js b/files/assets/js/following.js index ba846496c..883dc714b 100644 --- a/files/assets/js/following.js +++ b/files/assets/js/following.js @@ -1,4 +1,4 @@ function removeFollowing(t, username) { - post_toast(t,'/unfollow/' + username); + postToast(t,'/unfollow/' + username); t.parentElement.parentElement.remove(); } diff --git a/files/assets/js/pinpost.js b/files/assets/js/pinpost.js index 32c36ab6d..49a2fbf9e 100644 --- a/files/assets/js/pinpost.js +++ b/files/assets/js/pinpost.js @@ -1,7 +1,7 @@ function pinPost(t, id) { t.disabled = true; t.classList.add("disabled"); - post_toast_callback(`/sticky/${id}`, + postToast_callback(`/sticky/${id}`, { }, (xhr) => { diff --git a/files/assets/js/submission_admin.js b/files/assets/js/submission_admin.js index f85c8e310..544f6c8e7 100644 --- a/files/assets/js/submission_admin.js +++ b/files/assets/js/submission_admin.js @@ -1,7 +1,7 @@ function removePost(t,post_id,button1,button2,cls) { url="/remove_post/"+post_id - post_toast(t,url,button1,button2,cls) + postToast(t,url,button1,button2,cls) if (window.location.pathname == '/admin/reported/posts') { @@ -17,7 +17,7 @@ function removePost(t,post_id,button1,button2,cls) { function approvePost(t,post_id,button1,button2,cls) { url="/approve_post/"+post_id - post_toast(t,url,button1,button2,cls) + postToast(t,url,button1,button2,cls) if (window.location.pathname == '/admin/reported/posts') { diff --git a/files/assets/js/userpage_v.js b/files/assets/js/userpage_v.js index cf478ad16..d1713d3c9 100644 --- a/files/assets/js/userpage_v.js +++ b/files/assets/js/userpage_v.js @@ -35,7 +35,7 @@ function transferCoins(mobile=false) { let transferred = amount - Math.ceil(amount*TRANSFER_TAX); let username = document.getElementById('username').innerHTML; - post_toast_callback(`/@${username}/transfer_coins`, + postToast_callback(`/@${username}/transfer_coins`, { "amount": document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value, "reason": document.getElementById(mobile ? "coin-transfer-reason-mobile" : "coin-transfer-reason").value @@ -62,7 +62,7 @@ function transferBux(mobile=false) { let amount = parseInt(document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value); let username = document.getElementById('username').innerHTML - post_toast_callback(`/@${username}/transfer_bux`, + postToast_callback(`/@${username}/transfer_bux`, { "amount": document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value, "reason": document.getElementById(mobile ? "bux-transfer-reason-mobile" : "bux-transfer-reason").value diff --git a/files/classes/submission.py b/files/classes/submission.py index a552c8581..55b9774cc 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -323,7 +323,7 @@ class Submission(Base): body += " - WINNER!" if not winner and v and v.admin_level >= PERMS['POST_BETS_DISTRIBUTE']: - body += f'''''' + body += f'''''' body += "" else: input_type = 'radio' if o.exclusive else 'checkbox' diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 05f211f17..bfa5a5ff6 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -86,7 +86,7 @@

Casino

{%- endif %} @@ -109,41 +109,41 @@ {% if v.admin_level >= PERMS['SITE_SETTINGS'] %}
- +
- +
- +
- +
- +
{% if v.admin_level >= PERMS['SITE_SETTINGS_UNDER_ATTACK'] %}
- +
{% endif %} {% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] %} - + {% endif %}
{% if SITE_NAME == 'PCM' and v.admin_level >= PERMS['PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES'] %} - + {% endif %} {% endif %} diff --git a/files/templates/admin/app.html b/files/templates/admin/app.html index 1d937c2a3..6349c757a 100644 --- a/files/templates/admin/app.html +++ b/files/templates/admin/app.html @@ -34,12 +34,12 @@
{% if not app.client_id%} - - + + {% else %} - + {% endif %}
diff --git a/files/templates/admin/apps.html b/files/templates/admin/apps.html index 27f025862..c7a9ed188 100644 --- a/files/templates/admin/apps.html +++ b/files/templates/admin/apps.html @@ -40,12 +40,12 @@
{% if not app.client_id %} - - + + {% else %} - + {% endif %}
diff --git a/files/templates/admin/banned_domains.html b/files/templates/admin/banned_domains.html index 1b2d8bbc9..675002289 100644 --- a/files/templates/admin/banned_domains.html +++ b/files/templates/admin/banned_domains.html @@ -8,7 +8,7 @@ diff --git a/files/templates/comments.html b/files/templates/comments.html index 28b6c2800..210b166cc 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -222,7 +222,7 @@ Reported by: @@ -412,16 +412,16 @@ {%- endif %} - + - + {% endif %} {% if c.parent_submission %} {% if v and c.author_id == v.id %} - + {% elif v and c.body %} @@ -434,14 +434,14 @@