This commit is contained in:
Aevann1 2021-08-11 20:57:12 +02:00
parent e95edb6dbb
commit acf3ea6555
6 changed files with 31 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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",

View file

@ -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)

View file

@ -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'

View file

@ -144,6 +144,25 @@
</div>
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="controversial">Sort by Controversial</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="controversial" name="controversial"{% if v.controversial %} checked{% endif %} onchange="post_toast('/settings/profile?controversial='+document.getElementById('controversial').checked);">
<label class="custom-control-label" for="controversial"></label>
</div>
<span class="text-small-extra text-muted">Enable if you would like to automatically sort reddit.com links by controversial.</span>
</div>
</div>
</div>