diff --git a/files/assets/js/comments+submission_listing.js b/files/assets/js/comments+submission_listing.js index c081efc81..7642585db 100644 --- a/files/assets/js/comments+submission_listing.js +++ b/files/assets/js/comments+submission_listing.js @@ -50,7 +50,9 @@ function popclick(e) { popover.getElementsByClassName('pop-banner')[0].src = author["bannerurl"] popover.getElementsByClassName('pop-picture')[0].src = author["profile_url"] popover.getElementsByClassName('pop-username')[0].innerHTML = author["username"] - popover.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"] + if (popover.getElementsByClassName('pop-bio').length > 0) { + popover.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"] + } popover.getElementsByClassName('pop-postcount')[0].innerHTML = author["post_count"] popover.getElementsByClassName('pop-commentcount')[0].innerHTML = author["comment_count"] popover.getElementsByClassName('pop-coins')[0].innerHTML = author["coins"] diff --git a/files/classes/user.py b/files/classes/user.py index 74a75fe28..e39d29cf8 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -592,8 +592,9 @@ class User(Base): @property @lazy def banner_url(self): - if self.bannerurl: return self.bannerurl - else: return f"/i/{SITE_NAME}/site_preview.webp?v=3001" + if FEATURES['USERS_PROFILE_BANNER'] and self.bannerurl: + return self.bannerurl + return f"/i/{SITE_NAME}/site_preview.webp?v=3001" @property @lazy diff --git a/files/helpers/const.py b/files/helpers/const.py index a58254c37..168f9e962 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -151,8 +151,11 @@ FEATURES = { 'PRONOUNS': False, 'BADGES': True, 'HOUSES': False, - 'USERS_SUICIDE': True, 'GAMBLING': True, + 'USERS_PROFILE_BANNER': True, + 'USERS_PROFILE_BODYTEXT': True, + 'USERS_PROFILE_SONG': True, + 'USERS_SUICIDE': True, 'MARKUP_COMMANDS': True, } @@ -332,8 +335,11 @@ elif SITE == 'lgbdropthet.com': FEATURES['AWARDS'] = False FEATURES['CHAT'] = False FEATURES['BADGES'] = False - FEATURES['USERS_SUICIDE'] = False FEATURES['GAMBLING'] = False + FEATURES['USERS_PROFILE_BANNER'] = False + FEATURES['USERS_PROFILE_BODYTEXT'] = False + FEATURES['USERS_PROFILE_SONG'] = False + FEATURES['USERS_SUICIDE'] = False FEATURES['MARKUP_COMMANDS'] = False EMOJI_MARSEYS = False diff --git a/files/routes/settings.py b/files/routes/settings.py index 24f65a49c..fd76b9db2 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -144,7 +144,7 @@ def settings_profile_post(v): - elif request.values.get("friends"): + elif FEATURES['USERS_PROFILE_BODYTEXT'] and request.values.get("friends"): friends = request.values.get("friends")[:500] friends_html = sanitize(friends) @@ -170,7 +170,7 @@ def settings_profile_post(v): msg="Your friends list has been updated.") - elif request.values.get("enemies"): + elif FEATURES['USERS_PROFILE_BODYTEXT'] and request.values.get("enemies"): enemies = request.values.get("enemies")[:500] enemies_html = sanitize(enemies) @@ -196,7 +196,8 @@ def settings_profile_post(v): msg="Your enemies list has been updated.") - elif request.values.get("bio") or request.files.get('file'): + elif FEATURES['USERS_PROFILE_BODYTEXT'] and \ + (request.values.get("bio") or request.files.get('file')): bio = request.values.get("bio")[:1500] bio += process_files() @@ -536,6 +537,9 @@ def settings_images_profile(v): @limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}') @auth_required def settings_images_banner(v): + if not FEATURES['USERS_PROFILE_BANNER']: + abort(403) + if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403 file = request.files["banner"] @@ -746,6 +750,8 @@ def settings_name_change(v): @limiter.limit("3/second;10/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}') @auth_required def settings_song_change_mp3(v): + if not FEATURES['USERS_PROFILE_SONG']: + abort(403) file = request.files['file'] if file.content_type != 'audio/mpeg': @@ -776,6 +782,9 @@ def settings_song_change_mp3(v): @limiter.limit("3/second;10/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}') @auth_required def settings_song_change(v): + if not FEATURES['USERS_PROFILE_SONG']: + abort(403) + song=request.values.get("song").strip() if song == "" and v.song: diff --git a/files/templates/comments.html b/files/templates/comments.html index 1cc43559c..94bf92506 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -21,9 +21,12 @@
+ + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
+ {%- endif %} {% if FEATURES['BADGES'] -%}
diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 3c306b5be..58b95cb32 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -242,6 +242,8 @@
+ + {% if FEATURES['USERS_PROFILE_BANNER'] -%}

Profile Banner

@@ -275,6 +277,7 @@
+ {%- endif %}

Referrals

@@ -389,6 +392,8 @@ + + {% if FEATURES['USERS_PROFILE_SONG'] -%}
@@ -422,6 +427,8 @@
+ {%- endif %} +
@@ -599,7 +606,7 @@ {% endif %} - + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
@@ -671,6 +678,7 @@
+ {%- endif %} {% if v.patron or v.id == MOOSE_ID %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index d9e0e233c..478dfb515 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -24,9 +24,12 @@
+ + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
+ {%- endif %} {% if FEATURES['BADGES'] -%}
diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 55ea71fe9..1da3d6740 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -33,7 +33,7 @@
-
+
@@ -140,22 +140,24 @@
{% if u.basedcount %}

Based Count: {{u.basedcount}}

{% endif %} - {% if u.bio_html %} -

-					
{{u.bio_html | safe}}
- {% else %} -

No bio...

- {% endif %} + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%} + {% if u.bio_html %} +

+						
{{u.bio_html | safe}}
+ {% else %} +

No bio...

+ {% endif %} - {% if u.friends_html %} -

Friends:

-
{{u.friends_html | safe}}
- {% endif %} + {% if u.friends_html %} +

Friends:

+
{{u.friends_html | safe}}
+ {% endif %} - {% if u.enemies_html %} -

Enemies:

-
{{u.enemies_html | safe}}
- {% endif %} + {% if u.enemies_html %} +

Enemies:

+
{{u.enemies_html | safe}}
+ {% endif %} + {%- endif %} {% if u.received_awards and FEATURES['AWARDS'] %}
@@ -249,7 +251,7 @@ Profile views {% endif %} - {% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %} + {% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %} Toggle anthem {% endif %} @@ -458,19 +460,22 @@
last active {{u.last_active_date}} {%- endif %}
- {% if u.bio_html %} -
{{u.bio_html | safe}}
- {% endif %} - {% if u.friends_html %} -

Friends:

-
{{u.friends_html | safe}}
- {% endif %} + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%} + {% if u.bio_html %} +
{{u.bio_html | safe}}
+ {% endif %} - {% if u.enemies_html %} -

Enemies:

-
{{u.enemies_html | safe}}
- {% endif %} + {% if u.friends_html %} +

Friends:

+
{{u.friends_html | safe}}
+ {% endif %} + + {% if u.enemies_html %} +

Enemies:

+
{{u.enemies_html | safe}}
+ {% endif %} + {%- endif %} {% if u.received_awards and FEATURES['AWARDS'] %}
@@ -509,7 +514,7 @@ Profile views {% endif %} - {% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %} + {% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %} Toggle anthem {% endif %} @@ -770,7 +775,7 @@
-{% if u.song %} +{% if FEATURES['USERS_PROFILE_SONG'] and u.song %} {% if v and v.id == u.id %}
{{v.username}}
{% else %} diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 302320ad8..dbf447130 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -18,7 +18,7 @@ set CACHE_VER = { 'js/award_modal.js': 253, 'js/bootstrap.js': 275, - 'js/comments+submission_listing.js': 264, + 'js/comments+submission_listing.js': 265, 'js/submission_listing.js': 261, 'js/emoji_modal.js': 312, 'js/formatting.js': 240,