remotes/1693045480750635534/spooky-22
Aevann1 2021-11-12 16:06:22 +02:00
parent 166e87f76f
commit 951ba751c0
6 changed files with 26 additions and 15 deletions

View File

@ -363,7 +363,7 @@ class Comment(Base):
if v.filter_words and self.body and any([x in self.body for x in v.filter_words]): return True
if self.is_banned or (self.author and self.author.shadowbanned and not v.shadowbanned): return True
if self.is_banned: return True
return False

View File

@ -237,11 +237,11 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts = posts[:size]
if random.random() < 0.02:
if v and v.shadowbanned:
for post in posts:
if post.author and post.author.shadowbanned:
if post.author and post.author.shadowbanned and 86400 > time.time() - post.created_utc > 600:
rand = random.randint(5,20)
if post.score < rand: post.upvotes += 1
if post.upvotes < rand: post.upvotes = rand
g.db.add(post)
g.db.commit()

View File

@ -173,6 +173,13 @@ def post_id(pid, anything=None, v=None):
output.append(comment)
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)
@ -189,13 +196,6 @@ def post_id(pid, anything=None, v=None):
post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all()
if random.random() < 0.02:
for comment in post.replies:
if comment.author and comment.author.shadowbanned:
rand = random.randint(5,20)
if comment.score < rand: comment.upvotes += 1
g.db.add(comment)
post.views += 1
g.db.add(post)
if isinstance(session.get('over_18', 0), dict): session["over_18"] = 0
@ -685,9 +685,9 @@ def submit_post(v):
body_md = CustomRenderer().render(mistletoe.Document(body))
body_html = sanitize(body_md)
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 40
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400
if len(body_html) > 20000: abort(400)
if len(body_html) > 20000: return {"error":"Submission body too long!"}, 400
bans = filter_comment_html(body_html)
if bans:

View File

@ -453,7 +453,6 @@ def u_username(username, v=None):
next_exists = (len(ids) > 25)
ids = ids[:25]
# If page 1, check for sticky
if page == 1:
sticky = []
sticky = g.db.query(Submission).filter_by(is_pinned=True, author_id=u.id).all()
@ -463,6 +462,14 @@ 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",

View File

@ -33,6 +33,10 @@
<input id="kind" name="kind" value="" hidden>
<textarea id="note" maxlength="200" name="note" class="form-control" placeholder="Note to include in award notification..."></textarea>
<input id="giveaward" class="btn btn-primary" style="float:right" type="submit" value="Give Award" disabled>
<pre>
</pre>
</form>
</div>
</div>

View File

@ -42,7 +42,7 @@
</div>
<a class="btn btn-primary mt-3" href="javascript:void(0)" onclick="post_toast('/clear')">Clear all notifications</a>
<a class="btn btn-primary mt-3 ml-3" href="javascript:void(0)" onclick="post_toast('/clear')">Clear all notifications</a>
<div class="notifs p-3 p-md-0">