master
Aevann1 2022-03-28 00:11:26 +02:00
parent 2caaea15ab
commit 066ae95921
3 changed files with 16 additions and 44 deletions

View File

@ -85,7 +85,7 @@ gevent.spawn(leaderboard_thread())
@auth_required
def upvoters_posts(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -106,7 +106,7 @@ def upvoters_posts(v, username, uid):
@auth_required
def upvoters_comments(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -127,7 +127,7 @@ def upvoters_comments(v, username, uid):
@auth_required
def downvoters_posts(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -148,7 +148,7 @@ def downvoters_posts(v, username, uid):
@auth_required
def downvoters_comments(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -172,7 +172,7 @@ def downvoters_comments(v, username, uid):
@auth_required
def upvoting_posts(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -193,7 +193,7 @@ def upvoting_posts(v, username, uid):
@auth_required
def upvoting_comments(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -214,7 +214,7 @@ def upvoting_comments(v, username, uid):
@auth_required
def downvoting_posts(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -235,7 +235,7 @@ def downvoting_posts(v, username, uid):
@auth_required
def downvoting_comments(v, username, uid):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
if u.is_private and v.id != u.id: return render_template("userpage_private.html", u=u, v=v)
id = u.id
uid = int(uid)
@ -272,9 +272,7 @@ def agendaposters(v):
@app.get("/@<username>/upvoters")
@auth_required
def upvoters(v, username):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
id = u.id
id = get_user(username).id
votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Submission.ghost == False, Submission.is_banned == False, Submission.deleted_utc == 0, Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all()
@ -300,9 +298,7 @@ def upvoters(v, username):
@app.get("/@<username>/downvoters")
@auth_required
def downvoters(v, username):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
id = u.id
id = get_user(username).id
votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Submission.ghost == False, Submission.is_banned == False, Submission.deleted_utc == 0, Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all()
@ -326,9 +322,7 @@ def downvoters(v, username):
@app.get("/@<username>/upvoting")
@auth_required
def upvoting(v, username):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
id = u.id
id = get_user(username).id
votes = g.db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Submission.ghost == False, Submission.is_banned == False, Submission.deleted_utc == 0, Vote.vote_type==1, Vote.user_id==id).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
@ -352,9 +346,7 @@ def upvoting(v, username):
@app.get("/@<username>/downvoting")
@auth_required
def downvoting(v, username):
u = get_user(username)
if u.is_private and v.id != u.id: abort(403)
id = u.id
id = get_user(username).id
votes = g.db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Submission.ghost == False, Submission.is_banned == False, Submission.deleted_utc == 0, Vote.vote_type==-1, Vote.user_id==id).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
@ -836,7 +828,7 @@ def u_username(username, v=None):
if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"}
return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
return render_template("userpage_private.html", u=u, v=v)
if v and hasattr(u, 'is_blocking') and u.is_blocking:
@ -920,7 +912,7 @@ def u_username_comments(username, v=None):
if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"}
return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
return render_template("userpage_private.html", u=u, v=v)
if v and hasattr(u, 'is_blocking') and u.is_blocking:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"You are blocking @{u.username}."}

View File

@ -108,9 +108,7 @@
{% else %}<pre></pre>
{% endif %}
{% if not u.is_private or (v and v.id == u.id) %}
<div class="font-weight-bolder mb-2"><a class="mr-1" href="/@{{u.username}}/upvoters">Simps</a> | <a class="mx-1" href="/@{{u.username}}/downvoters">Haters</a> | <a class="mx-1" href="/@{{u.username}}/upvoting">Simps for</a> | <a class="ml-1" href="/@{{u.username}}/downvoting">Hates</a></div>
{% endif %}
<div class="font-weight-bolder">
<span id="profile-coins-amount">{{u.coins}}</span>
@ -406,9 +404,7 @@
<pre></pre>
{% endif %}
{% if not u.is_private or (v and v.id == u.id) %}
<div class="font-weight-bolder mb-2"><a class="mr-1" href="/@{{u.username}}/upvoters">Simps</a> | <a class="mx-1" href="/@{{u.username}}/downvoters">Haters</a> | <a class="mx-1" href="/@{{u.username}}/upvoting">Simps for</a> | <a class="ml-1" href="/@{{u.username}}/downvoting">Hates</a></div>
{% endif %}
<div class="font-weight-normal">
<span id="profile-coins-amount-mobile" class="font-weight-bold">{{u.coins}}</span>

View File

@ -11,22 +11,6 @@
</span>
<h2 class="h5">This account is private</h2>
<p class="text-muted">This user has enabled private mode to cloak their posting history.</p>
{% if u.id == LLM_ID %}
{% if v and v.coins > 500 and not v.is_suspended %}
<a class="btn btn-primary" role="button", onclick="post_toast(this,'/pay_rent', '1')">Pay rent to view profile (500 coins)</a>
{% endif %}
<pre></pre>
{% if v and v.coins > 5000 and time - v.created_utc > 604800 and not v.is_suspended %}
<a class="btn btn-primary" role="button", onclick="post_toast(this,'/steal', '1')">Attempt to steal coins</a>
<div class="text-small-extra text-muted mt-1">Landlords, like all other men, love to reap where they never sowed.</div>
{% endif %}
<pre>
</pre>
{% endif %}
</div>
</div>
</div>