From ceb126dae43b60ff11847f18c9d9f51bb7c30a53 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 12 Aug 2023 20:55:51 +0300 Subject: [PATCH] disable "effect on author" tab in award modal when award ghosted posts/comments to fix this issue https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/4584788#context --- files/assets/js/bottom.js | 15 +++++++++++++++ files/templates/comments.html | 4 ++-- files/templates/modals/award.html | 8 ++++---- files/templates/post_actions.html | 2 +- files/templates/post_actions_mobile.html | 2 +- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/files/assets/js/bottom.js b/files/assets/js/bottom.js index bfe2d2d5b..2647f0671 100644 --- a/files/assets/js/bottom.js +++ b/files/assets/js/bottom.js @@ -182,6 +182,21 @@ document.addEventListener("click", function (e) { return } document.getElementById('giveaward').dataset.action = element.dataset.url + + const effect_author_tab = document.getElementById('effect-author-tab') + const effect_content_tab = document.getElementById('effect-content-tab') + const effect_author_section = document.getElementById('effect-author-section') + const effect_content_section = document.getElementById('effect-content-section') + if (element.dataset.ghost == 'True') { + effect_author_tab.classList.add('disabled') + effect_author_tab.classList.remove('active') + effect_author_section.classList.add('d-none') + effect_content_tab.classList.add('active') + effect_content_section.classList.remove('d-none') + } + else { + effect_author_tab.classList.remove('disabled') + } } diff --git a/files/templates/comments.html b/files/templates/comments.html index c9247000b..3bd2d9ad0 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -395,7 +395,7 @@ {% if FEATURES['AWARDS'] -%} - + {%- endif %} @@ -594,7 +594,7 @@ {% if FEATURES['AWARDS'] -%} - + {%- endif %} diff --git a/files/templates/modals/award.html b/files/templates/modals/award.html index 7b8c30bf1..23d889f9a 100644 --- a/files/templates/modals/award.html +++ b/files/templates/modals/award.html @@ -11,10 +11,10 @@