forked from rDrama/rDrama
1
0
Fork 0

repurpose "upvoted" to "voted"

master
Aevann1 2022-11-22 23:28:30 +02:00
parent ff9e0956ef
commit e198102383
2 changed files with 9 additions and 10 deletions

View File

@ -128,7 +128,7 @@ def downvoting_posts(v, username, uid):
def downvoting_comments(v, username, uid):
return upvoting_downvoting(v, username, uid, Comment, CommentVote, -1, "userpage/voted_comments.html", True)
def user_voted(v, username, cls, vote_cls, vote_dir, template, standalone):
def user_voted(v, username, cls, vote_cls, template, standalone):
u = get_user(username, v=v, include_shadowbanned=False)
if not u.is_visible_to(v): abort(403)
if not (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']): abort(403)
@ -142,7 +142,6 @@ def user_voted(v, username, cls, vote_cls, vote_dir, template, standalone):
cls.deleted_utc == 0,
cls.author_id != u.id,
vote_cls.user_id == u.id,
vote_cls.vote_type == vote_dir
).order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
listing = [p.id for p in listing]
@ -157,16 +156,16 @@ def user_voted(v, username, cls, vote_cls, vote_dir, template, standalone):
return render_template(template, next_exists=next_exists, listing=listing, page=page, v=v, standalone=standalone)
@app.get("/@<username>/upvoted/posts")
@app.get("/@<username>/voted/posts")
@auth_required
def user_upvoted_posts(v, username):
return user_voted(v, username, Submission, Vote, 1, "userpage/voted_posts.html", None)
def user_voted_posts(v, username):
return user_voted(v, username, Submission, Vote, "userpage/voted_posts.html", None)
@app.get("/@<username>/upvoted/comments")
@app.get("/@<username>/voted/comments")
@auth_required
def user_upvoted_comments(v, username):
return user_voted(v, username, Comment, CommentVote, 1, "userpage/voted_comments.html", True)
def user_voted_comments(v, username):
return user_voted(v, username, Comment, CommentVote, "userpage/voted_comments.html", True)
@app.get("/grassed")

View File

@ -70,7 +70,7 @@
{% endif %}
{% if v and (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']) -%}
<div class="font-weight-bolder mb-2" id="profile--simphate"><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="mx-1" href="/@{{u.username}}/downvoting">Hates</a> | <a class="ml-1" href="/@{{u.username}}/upvoted/posts">Upvoted</a></div>
<div class="font-weight-bolder mb-2" id="profile--simphate"><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="mx-1" href="/@{{u.username}}/downvoting">Hates</a> | <a class="ml-1" href="/@{{u.username}}/voted/posts">Voted</a></div>
{%- endif %}
<div class="font-weight-bolder">
@ -302,7 +302,7 @@
{% endif %}
{% if v and (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']) -%}
<div class="font-weight-bolder mb-2" id="profile-mobile--simphate"><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="mx-1" href="/@{{u.username}}/downvoting">Hates</a> | <a class="ml-1" href="/@{{u.username}}/upvoted/posts">Upvoted</a></div>
<div class="font-weight-bolder mb-2" id="profile-mobile--simphate"><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="mx-1" href="/@{{u.username}}/downvoting">Hates</a> | <a class="ml-1" href="/@{{u.username}}/voted/posts">Voted</a></div>
{%- endif %}
<div class="font-weight-normal">