forked from rDrama/rDrama
1
0
Fork 0
Aevann 2024-02-18 18:27:33 +02:00
parent e76fb8caa9
commit be490f8562
3 changed files with 14 additions and 8 deletions

View File

@ -1025,7 +1025,7 @@ class User(Base):
'marseybux': self.marseybux,
'post_count': self.real_post_count(v),
'comment_count': self.real_comment_count(v),
'badges': [[x.path, x.text, x.until] for x in self.ordered_badges],
'badges': [[x.path, x.text, x.until] for x in self.ordered_badges(v)],
'created_date': self.created_date,
'original_usernames': self.original_usernames_popover,
}
@ -1060,7 +1060,6 @@ class User(Base):
'bio_html': self.bio_html_eager,
'flair': self.flair,
'flair_html': self.flair_html,
'badges': [x.json for x in self.ordered_badges],
'coins': self.coins,
'post_count': self.real_post_count(g.v),
'comment_count': self.real_comment_count(g.v),
@ -1341,10 +1340,14 @@ class User(Base):
return output
@property
@lazy
def ordered_badges(self):
return sorted(self.badges, key=badge_ordering_func)
def ordered_badges(self, v):
badges = self.badges
if not self.lifetimedonated_visible and not (v.id == self.id or v.admin_level >= PERMS['VIEW_PATRONS']):
badges = [x for x in badges if badge.id not in {22, 23, 24, 25, 26, 27, 28, 257, 258, 259, 260, 261}]
return sorted(badges, key=badge_ordering_func)
@lazy
def rendered_sig(self, v):

View File

@ -252,11 +252,14 @@
{{common.text_area_section('profile-signature', '/settings/personal', 'sig', 'Signature', v.sig, 'Limit of 200 characters', 'Enter a signature...', true, 200)}}
{{common.toggle_section('Private Mode', 'privateswitch', 'private', v.is_private, 'This will hide your profile page from other users.', false)}}
{{common.toggle_section('Lifetime Donated and Total Award Discount Visiblity', 'lifetimedonated_visibleswitch', 'lifetimedonated_visible', v.lifetimedonated_visible, 'Make the "lifetime donated" field and the "total award discount" field in your profile visible to everyone instead of just you.', false)}}
{{common.toggle_section('Donation Visiblity', 'lifetimedonated_visibleswitch', 'lifetimedonated_visible', v.lifetimedonated_visible, 'Make your donation badges, your lifetime-donated amount, and your total award discount visible to everyone instead of just you.', false)}}
{{common.toggle_section('Cursor Marsey', 'cursormarseyswitch', 'cursormarsey', v.cursormarsey, 'Have a cute
marsey accompany you during your journey on the site.', false)}}
{{common.toggle_section('Spider', 'spiderswitch', 'spider', v.spider, 'Have a spider friend accompany you during your journey on the site.', v.spider > 1)}}
{{common.toggle_section('Marsify', 'marsifyswitch', 'marsify', v.marsify, 'Automatically insert relevant
marseys into your future comments.', v.marsify > 1)}}
</div>

View File

@ -308,7 +308,7 @@
{% if FEATURES['BADGES'] -%}
<div id="profile--badges">
{% for b in u.ordered_badges %}
{% for b in u.ordered_badges(v) %}
{% if b.url %}
<a rel="noopener" href="{{b.url}}">
<img class="contain" alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" data-nonce="{{g.nonce}}" data-onmouseover="badge_timestamp(this)"{% endif %}>
@ -485,7 +485,7 @@
{% endif %}
<div class="mb-3" id="profile-mobile--badges">
{% for b in u.ordered_badges %}
{% for b in u.ordered_badges(v) %}
{% if b.url %}
<a rel="noopener" href="{{b.url}}">
<img class="contain" alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" data-nonce="{{g.nonce}}" data-onmouseover="badge_timestamp(this)"{% endif %}>