add can_see_donate_service

pull/225/head
Aevann 2024-02-25 08:25:15 +02:00
parent 18c89f0d1a
commit 698c413c5b
4 changed files with 20 additions and 3 deletions

View File

@ -1243,6 +1243,23 @@ class User(Base):
return False
@property
@lazy
def can_see_donate_service(self):
if DONATE_LINK == DEFAULT_CONFIG_VALUE:
return False
if self.can_see_restricted_holes != None:
return self.can_see_restricted_holes
if self.chud == 1: return False
if self.truescore >= TRUESCORE_DONATE_MINIMUM: return True
if self.patron: return True
return False
@property
@lazy
def can_post_in_ghost_threads(self):

View File

@ -2,7 +2,7 @@
{% block pagetitle %}Donate{% endblock %}
{% block content %}
<div class="px-2">
{% set can_see = DONATE_LINK != DEFAULT_CONFIG_VALUE and v and v.can_see_countryclub and v.chud != 1 %}
{% set can_see = v and v.can_see_donate_service %}
<h3 class="mt-5 text-success">Donation Methods</h1>
<div class="overflow-x-auto">

View File

@ -13,7 +13,7 @@
</div>
<div class="body w-lg-100">
<p>You're a {{TIER_TO_NAME[v.patron] if v.patron else "freeloader"}}!</p>{% if v.patron %} Thanks ily! &lt;3{% endif %}
{% if not v.patron and v.truescore >= TRUESCORE_DONATE_MINIMUM and DONATE_LINK != DEFAULT_CONFIG_VALUE %}
{% if not v.patron and v.can_see_donate_service %}
<p class="font-italic">To stop freeloading, first <a href="/settings/security#site-settings-email-section">verify your email</a>, then support us on <a href="{{DONATE_LINK}}">{{DONATE_SERVICE}}</a> with the same email, and then click "Claim Donation Rewards" <a href="/settings/security#site-settings-email-section">here</a></p>
{% elif not v.patron %}
<p class="font-italic">To stop freeloading, you can <a href="/donate">donate by crypto</a>. If you do that, please let us know by <a href="/contact">sending us the transaction id via modmail</a> so we can give you your donation rewards manually!</p>

View File

@ -43,7 +43,7 @@
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Add email">
{% endif %}
</div>
{% if v.truescore >= TRUESCORE_DONATE_MINIMUM and DONATE_LINK != DEFAULT_CONFIG_VALUE %}
{% if v.can_see_donate_service %}
<div class="text-small text-muted pl-1 pt-1 pt-sm-3">
Must be same email as the one you used to donate on <a rel="noopener" class="text-primary novisited" href="{{DONATE_LINK}}">{{DONATE_SERVICE}}</a>
</div>