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

pull/193/head
Aevann 2023-08-12 20:55:51 +03:00
parent 1519c32933
commit ceb126dae4
5 changed files with 23 additions and 8 deletions

View File

@ -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')
}
}

View File

@ -395,7 +395,7 @@
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" data-nonce="{{g.nonce}}" data-onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
{% if FEATURES['AWARDS'] -%}
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award/comment/{{c.id}}" data-nonce="{{g.nonce}}" {% if c.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift"></i>Give Award</button>
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award/comment/{{c.id}}" data-ghost="{{c.ghost}}" data-nonce="{{g.nonce}}" {% if c.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift"></i>Give Award</button>
{%- endif %}
<button type="button" id="unsave-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id in v.saved_comment_idlist %}d-md-inline-block{% endif %} text-muted d-none" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unsave_comment/{{c.id}}','save-{{c.id}}','unsave-{{c.id}}','d-md-inline-block')"><i class="fas fa-save"></i>Unsave {% if c.num_savers %}<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="Number of users who saved this comment">[{{c.num_savers}}]</span>{% endif %}</button>
@ -594,7 +594,7 @@
<button type="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportCommentModal" data-nonce="{{g.nonce}}" data-onclick="report_commentModal('{{c.id}}','{{c.author_name}}')" class="list-group-item"><i class="fas fa-flag mr-2"></i>Report</button>
{% if FEATURES['AWARDS'] -%}
<button type="button" class="list-group-item" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award/comment/{{c.id}}" data-nonce="{{g.nonce}}" {% if c.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift mr-2"></i>Give Award</button>
<button type="button" class="list-group-item" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award/comment/{{c.id}}" data-ghost="{{c.ghost}}" data-nonce="{{g.nonce}}" {% if c.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift mr-2"></i>Give Award</button>
{%- endif %}
<button type="button" id="save2-{{c.id}}" class="list-group-item {% if c.id in v.saved_comment_idlist %}d-none{% endif %}" data-bs-dismiss="modal" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/save_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}','d-none')"><i class="fas fa-save mr-2"></i>Save {% if c.num_savers %}<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="Number of users who saved this comment">[{{c.num_savers}}]</span>{% endif %}</button>

View File

@ -11,10 +11,10 @@
</div>
<div id="awardModalBody" class="modal-body pt-2 mb-3">
<div class="row box-shadow-bottom bg-white pt-1 pb-4" style="justify-content: center;">
<button class="btn btn-primary btn-block m-0 shop-tab award-tab active" data-nonce="{{g.nonce}}" data-onclick="switchAwardTab()">
<button id="effect-content-tab" class="btn btn-primary btn-block m-0 shop-tab award-tab active" data-nonce="{{g.nonce}}" data-onclick="switchAwardTab()">
<span class="mr-auto ml-auto"><i class="fas fa-gift mr-2"></i>EFFECT ON CONTENT</span>
</button>
<button class="btn btn-primary btn-block m-0 shop-tab award-tab" data-nonce="{{g.nonce}}" data-onclick="switchAwardTab()">
<button id="effect-author-tab" class="btn btn-primary btn-block m-0 shop-tab award-tab" data-nonce="{{g.nonce}}" data-onclick="switchAwardTab()">
<span class="mr-auto ml-auto"><i class="fas fa-gift mr-2"></i>EFFECT ON AUTHOR</span>
</button>
</div>
@ -30,10 +30,10 @@
{% endfor %}
{% endmacro %}
<div class="award-section">
<div id="effect-content-section" class="award-section">
{{iterate_awards(v.awards_content_effect)}}
</div>
<div class="award-section d-none">
<div id="effect-author-section" class="award-section d-none">
{{iterate_awards(v.awards_author_effect)}}
</div>
</div>

View File

@ -8,7 +8,7 @@
{% endif %}
{% if v and FEATURES['AWARDS'] %}
<button type="button" class="list-inline-item d-none d-md-inline-block" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}' data-nonce="{{g.nonce}}" {% if p.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift fa-fw"></i>Give Award</button>
<button type="button" class="list-inline-item d-none d-md-inline-block" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}' data-ghost="{{p.ghost}}" data-nonce="{{g.nonce}}" {% if p.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift fa-fw"></i>Give Award</button>
{% endif %}
<button type="button" class="list-inline-item copy-link" data-clipboard-text="{% if SITE == 'rdrama.net' %}{{SITE_FULL}}{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>

View File

@ -14,7 +14,7 @@
<button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" data-nonce="{{g.nonce}}" data-onclick="report_postModal('{{p.id}}')"><i class="far fa-flag text-center text-muted mr-2"></i>Report</button>
{% if FEATURES['AWARDS'] -%}
<button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}' data-nonce="{{g.nonce}}" {% if p.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift text-center text-muted mr-2"></i>Give Award</button>
<button type="button" class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}' data-ghost="{{p.ghost}}" data-nonce="{{g.nonce}}" {% if p.author.immune_to_awards(v) %}disabled{% endif %}><i class="fas fa-gift text-center text-muted mr-2"></i>Give Award</button>
{%- endif %}
<button type="button" id="subscribe2-{{p.id}}" class="{% if p.id in v.subscribed_idlist %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" data-areyousure="postToastSwitch(this,'/subscribe/{{p.id}}','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}','d-none')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-dismiss="modal"><i class="fas fa-bell text-center text-muted mr-2"></i>Subscribe {% if p.num_subscribers %}<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="Number of subscribers">[{{p.num_subscribers}}]</span>{% endif %}</button>