remotes/1693045480750635534/spooky-22
Aevann1 2021-11-13 23:07:59 +02:00
parent 955d4283ec
commit 9ec7856091
5 changed files with 16 additions and 22 deletions

View File

@ -326,6 +326,14 @@ class Comment(Base):
url_noquery = url.split('?')[0]
body = body.replace(url, f"{url_noquery}?{urlencode(p, True)}")
if v and v.shadowbanned and self.author and self.author.shadowbanned and 86400 > time.time() - self.created_utc > 600:
rand = random.randint(5,20)
if self.upvotes < rand:
self.upvotes = rand
g.db.add(self)
g.db.commit()
return body
def plainbody(self, v):

View File

@ -327,6 +327,14 @@ 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 v and v.shadowbanned and self.author and self.author.shadowbanned and 86400 > time.time() - self.created_utc > 600:
rand = random.randint(5,20)
if self.upvotes < rand:
self.upvotes = rand
g.db.add(self)
g.db.commit()
return body
def plainbody(self, v):

View File

@ -237,14 +237,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts = posts[:size]
if v and v.shadowbanned:
for post in posts:
if post.author and post.author.shadowbanned and 86400 > time.time() - post.created_utc > 600:
rand = random.randint(5,20)
if post.upvotes < rand: post.upvotes = rand
g.db.add(post)
g.db.commit()
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False)
if v and v.admin_level == 0:
blocking = [x[0] for x in g.db.query(UserBlock.target_id).filter_by(user_id=v.id).all()]

View File

@ -175,12 +175,6 @@ def post_id(pid, anything=None, v=None):
post.replies = [x for x in output if x.is_pinned] + [x for x in output if x.level == 1 and not x.is_pinned]
if v.shadowbanned:
for comment in post.replies:
if comment.author and comment.author.shadowbanned and 86400 > time.time() - comment.created_utc > 600:
rand = random.randint(5,20)
if comment.upvotes < rand: comment.upvotes = rand
g.db.add(comment)
else:
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ACCOUNT)

View File

@ -462,14 +462,6 @@ def u_username(username, v=None):
listing = get_posts(ids, v=v)
if v and v.shadowbanned:
for post in listing:
if post.author and post.author.shadowbanned and 86400 > time.time() - post.created_utc > 600:
rand = random.randint(5,20)
if post.upvotes < rand: post.upvotes = rand
g.db.add(post)
g.db.commit()
if u.unban_utc:
if request.headers.get("Authorization"): {"data": [x.json for x in listing]}
else: return render_template("userpage.html",