Hide website and donate links on the profiles of New Members

This commit is contained in:
rubenwardy
2025-09-23 16:35:46 +01:00
parent dfa4e5a7a3
commit feeed21b94
3 changed files with 12 additions and 2 deletions

View File

@@ -96,6 +96,7 @@ class Permission(enum.Enum):
CHANGE_USERNAMES = "CHANGE_USERNAMES"
CHANGE_RANK = "CHANGE_RANK"
CHANGE_EMAIL = "CHANGE_EMAIL"
LINK_TO_WEBSITE = "LINK_TO_WEBSITE"
SEE_THREAD = "SEE_THREAD"
CREATE_THREAD = "CREATE_THREAD"
COMMENT_THREAD = "COMMENT_THREAD"
@@ -289,6 +290,8 @@ class User(db.Model, UserMixin):
return user.rank.at_least(UserRank.NEW_MEMBER)
else:
return user.rank.at_least(UserRank.MODERATOR) and user.rank.at_least(self.rank)
elif perm == Permission.LINK_TO_WEBSITE:
return user.rank.at_least(UserRank.MEMBER)
else:
raise Exception("Permission {} is not related to users".format(perm.name))

View File

@@ -88,7 +88,7 @@
</a>
{% endif %}
{% if user.website_url %}
{% if user.website_url and user.check_perm(user, "LINK_TO_WEBSITE") %}
<a class="btn" href="{{ user.website_url }}" rel="ugc">
<i class="fas fa-globe-europe"></i>
<span class="count">
@@ -97,7 +97,7 @@
</a>
{% endif %}
{% if user.donate_url %}
{% if user.donate_url and user.check_perm(user, "LINK_TO_WEBSITE") %}
<a class="btn" href="{{ user.donate_url }}" rel="ugc">
<i class="fas fa-donate"></i>
<span class="count">

View File

@@ -67,6 +67,13 @@
{{ render_field(form.donate_url, tabindex=233) }}
{% endif %}
{% if not user.check_perm(user, "LINK_TO_WEBSITE") %}
<p>
{{ _("Website URLs will not be shown whilst you are a 'New Member'.") }}
{{ _("To become a full member, create a review, comment, or package and wait 7 days.") }}
</p>
{% endif %}
<p>
{{ render_submit_field(form.submit, tabindex=280) }}
</p>