diff --git a/files/classes/comment.py b/files/classes/comment.py index f3597d5ba..fffe6f222 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -245,6 +245,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): body = self.comment_aux.body_html if not v or v.slurreplacer: body = body.replace(" nigger"," 🏀").replace(" Nigger"," 🏀").replace(" NIGGER"," 🏀").replace(" pedo"," libertarian").replace(" Pedo"," Libertarian ").replace(" PEDO"," LIBERTARIAN ").replace(" tranny"," 🚄").replace(" Tranny"," 🚄").replace(" TRANNY"," 🚄").replace(" fag"," cute twink").replace(" Fag"," Cute twink").replace(" FAG"," CUTE TWINK").replace(" faggot"," cute twink").replace(" Faggot"," Cute twink").replace(" FAGGOT"," CUTE TWINK").replace(" trump"," DDR").replace(" Trump"," DDR").replace(" TRUMP"," DDR").replace(" biden"," DDD").replace(" Biden"," DDD").replace(" BIDEN"," DDD").replace(" steve akins"," penny verity oaken").replace(" Steve Akins"," Penny Verity Oaken").replace(" STEVE AKINS"," PENNY VERITY OAKEN").replace(" RETARD"," RSLUR").replace(" rapist"," male feminist").replace(" Rapist"," Male feminist").replace(" RAPIST"," MALE FEMINIST").replace(" RETARD"," RSLUR").replace(" rapist"," male feminist").replace(" Rapist"," Male feminist").replace(" RAPIST"," MALE FEMINIST").replace(" RETARD"," RSLUR").replace(" rapist"," male feminist").replace(" Rapist"," Male feminist").replace(" RAPIST"," MALE FEMINIST").replace(" kill yourself"," keep yourself safe").replace(" KILL YOURSELF"," KEEP YOURSELF SAFE").replace(" trannie"," 🚄").replace(" Trannie"," 🚄").replace(" TRANNIE"," 🚄").replace(" troon"," 🚄").replace(" Troon"," 🚄").replace(" TROON"," 🚄") if v and not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com") + return body @property diff --git a/files/classes/submission.py b/files/classes/submission.py index 27558c8f8..148a15770 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -310,9 +310,12 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): def realurl(self, v): if v and v.agendaposter and random.randint(1, 10) < 4: return 'https://secure.actblue.com/donate/ms_blm_homepage_2019' - elif self.url: - if v and not v.oldreddit: return self.url.replace("old.reddit.com", "reddit.com") - if self.url: return self.url + elif self.url.startswith("https://old.reddit.com/"): + url = self.url + if v and not v.oldreddit: url = self.url.replace("old.reddit.com", "reddit.com") + if v and v.controversial and '/comments/' in url: + if "?" in url: url += "&sort=controversial" + else: url += "/?sort=controversial" return "" @property diff --git a/files/classes/user.py b/files/classes/user.py index a77c18521..2fc831601 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -55,6 +55,7 @@ class User(Base, Stndrd, Age_times): newtabexternal = Column(Boolean, default=True) zzz = Column(Boolean, default=False) oldreddit = Column(Boolean, default=False) + controversial = Column(Boolean, default=False) submissions = relationship( "Submission", lazy="dynamic", diff --git a/files/routes/posts.py b/files/routes/posts.py index 917c0d0d3..44d0828cf 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -786,7 +786,6 @@ def submit_post(v): url = url.replace("https://mobile.twitter.com", "https://twitter.com") if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/") - # if url.startswith("https://old.reddit.com/") and '/comments/' in url and '?' not in url: url += "?sort=controversial" title_html = sanitize(title, linkgen=True, flair=True) diff --git a/files/routes/settings.py b/files/routes/settings.py index 16affdc65..6a8c06d9c 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -42,6 +42,10 @@ def settings_profile_post(v): updated = True v.oldreddit = request.values.get("oldreddit", None) == 'true' + if request.values.get("controversial", v.controversial) != v.controversial: + updated = True + v.controversial = request.values.get("controversial", 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 2b7b499ed..3bdc9595d 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -144,6 +144,25 @@ + +
+ +
+ +
+ +
+ +
+ + +
+ + Enable if you would like to automatically sort reddit.com links by controversial. + +
+ +