From 16032ec1aafb4179e32d3fd6b0ae764f03588ae3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 4 Nov 2021 19:24:43 +0200 Subject: [PATCH] sigs toggle --- files/classes/comment.py | 2 +- files/classes/submission.py | 2 +- files/classes/user.py | 1 + files/routes/settings.py | 4 ++++ files/templates/settings_filters.html | 26 ++++++++++++++++++++++++-- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index dca421d79..707fc57bf 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -316,7 +316,7 @@ class Comment(Base): url_noquery = url.split('?')[0] body = body.replace(url, f"{url_noquery}?{urlencode(p, True)}") - if self.author.sig_html: return body + '
' + self.author.sig_html + if self.author.sig_html and not (v and v.sigs_disabled): return body + '
' + self.author.sig_html return body def plainbody(self, v): diff --git a/files/classes/submission.py b/files/classes/submission.py index 8939630b7..449dc79ed 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -316,7 +316,7 @@ class Submission(Base): if v and not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com") if v and v.nitter: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net") - if self.author.sig_html: return body + '
' + self.author.sig_html + if self.author.sig_html and not (v and v.sigs_disabled): return body + '
' + self.author.sig_html return body def plainbody(self, v): diff --git a/files/classes/user.py b/files/classes/user.py index 7c07ed9c6..fbe000d9c 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -86,6 +86,7 @@ class User(Base): bio_html = Column(String) sig = Column(String) sig_html = Column(String) + sigs_disabled = Column(Boolean) friends = Column(String) friends_html = Column(String) is_banned = Column(Integer, default=0) diff --git a/files/routes/settings.py b/files/routes/settings.py index f943cd917..3222627da 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -89,6 +89,10 @@ def settings_profile_post(v): updated = True v.controversial = request.values.get("controversial", None) == 'true' + if request.values.get("sigs_disabled", v.sigs_disabled) != v.sigs_disabled: + updated = True + v.sigs_disabled = request.values.get("sigs_disabled", None) == 'true' + if request.values.get("over18", v.over_18) != v.over_18: updated = True v.over_18 = request.values.get("over18", None) == 'true' diff --git a/files/templates/settings_filters.html b/files/templates/settings_filters.html index 164c36331..95be72c9c 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -219,6 +219,28 @@
+ +
+ +
+ +
+ +
+ +
+ + +
+ + Disable seeing user signatures. + +
+ +
+ + +
@@ -228,7 +250,7 @@
- +
@@ -292,7 +314,7 @@
+ rows="3" name="filters" form="custom-filter" maxlength="1000">{% if v.custom_filter_list %}{{v.custom_filter_list}}{% endif %}
Use a new line for each filter entry. Limit of 1000 characters.