master
Aevann1 2021-12-05 20:58:46 +02:00
parent 949f6d28bb
commit 13bd73d4d8
3 changed files with 14 additions and 18 deletions

View File

@ -336,6 +336,7 @@ class Submission(Base):
rand = random.randint(0, maxupvotes)
if self.upvotes < rand:
amount = random.randint(0, 3)
self.views += amount*random.randint(3, 5)
self.upvotes += amount
g.db.add(self)
self.author.coins += amount

View File

@ -429,25 +429,20 @@ def all_comments(v):
sort=request.values.get("sort", "new")
t=request.values.get("t", defaulttimefilter)
if request.values.get("shadowbanned") and v and v.admin_level > 1:
idlist = comment_idlist(v=v,
page=page,
sort=sort,
t=t,
shadowbanned=true
)
comments = get_comments(idlist, v=v, shadowbanned=True)
else:
idlist = comment_idlist(v=v,
page=page,
sort=sort,
t=t,
)
comments = get_comments(idlist, v=v)
if request.values.get("shadowbanned") and v and v.admin_level > 1: shadowbanned = True
else: shadowbanned = False
idlist = comment_idlist(v=v,
page=page,
sort=sort,
t=t,
shadowbanned=shadowbanned
)
comments = get_comments(idlist, v=v, shadowbanned=shadowbanned)
next_exists = len(idlist) > 25
idlist = idlist[:25]
if request.headers.get("Authorization"): return {"data": [x.json for x in comments]}
else: return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists)
else: return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists, shadowbanned=shadowbanned)

View File

@ -71,14 +71,14 @@
<ul class="pagination pagination-sm mb-0">
{% if page>1 %}
<li class="page-item">
<small><a class="page-link" href="?page={{page-1}}&sort={{sort}}&t={{t}}" tabindex="-1">Prev</a></small>
<small><a class="page-link" href="?page={{page-1}}&sort={{sort}}&t={{t}}{% if shadowbanned %}&shadowbanned=true{% endif %}" tabindex="-1">Prev</a></small>
</li>
{% else %}
<li class="page-item disabled"><span class="page-link">Prev</span></li>
{% endif %}
{% if next_exists %}
<li class="page-item">
<small><a class="page-link" href="?page={{page+1}}&sort={{sort}}&t={{t}}">Next</a></small>
<small><a class="page-link" href="?page={{page+1}}&sort={{sort}}&t={{t}}{% if shadowbanned %}&shadowbanned=true{% endif %}">Next</a></small>
</li>
{% else %}
<li class="page-item disabled"><span class="page-link">Next</span></li>