forked from MarseyWorld/MarseyWorld
make users list viewable by everypony
parent
37aa25c139
commit
dd3dfa5197
|
@ -441,7 +441,6 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'VIEW_PRIVATE_PROFILES': 2,
|
||||
'VIEW_ALTS': 2,
|
||||
'VIEW_ACTIVE_USERS': 2,
|
||||
'VIEW_ALL_USERS': 2,
|
||||
'VIEW_ALT_VOTES': 2,
|
||||
'VIEW_LAST_ACTIVE': 2,
|
||||
'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes
|
||||
|
|
|
@ -622,28 +622,6 @@ def badge_remove_post(v):
|
|||
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, msg=f"{badge.name} Badge removed from @{user.username} successfully!")
|
||||
|
||||
|
||||
@app.get("/admin/users")
|
||||
@admin_level_required(PERMS['VIEW_ALL_USERS'])
|
||||
def users_list(v):
|
||||
|
||||
try: page = int(request.values.get("page", 1))
|
||||
except: page = 1
|
||||
|
||||
users = g.db.query(User).order_by(User.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
|
||||
|
||||
next_exists = (len(users) > PAGE_SIZE)
|
||||
users = users[:PAGE_SIZE]
|
||||
|
||||
return render_template("user_cards.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
page=page,
|
||||
user_cards_title="Users Feed",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@app.get("/admin/alt_votes")
|
||||
@admin_level_required(PERMS['VIEW_ALT_VOTES'])
|
||||
def alt_votes_get(v):
|
||||
|
|
|
@ -1308,3 +1308,23 @@ def settings_kofi(v:User):
|
|||
badge_grant(badge_id=20+highest_tier, user=v)
|
||||
|
||||
return {"message": f"{patron} rewards claimed!"}
|
||||
|
||||
@app.get("/users")
|
||||
@auth_required
|
||||
def users_list(v):
|
||||
|
||||
try: page = int(request.values.get("page", 1))
|
||||
except: page = 1
|
||||
|
||||
users = g.db.query(User).order_by(User.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
|
||||
|
||||
next_exists = (len(users) > PAGE_SIZE)
|
||||
users = users[:PAGE_SIZE]
|
||||
|
||||
return render_template("user_cards.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
page=page,
|
||||
user_cards_title="Users Feed",
|
||||
)
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
|
||||
<h4>Users</h4>
|
||||
<ul>
|
||||
{% if v.admin_level >= PERMS['VIEW_ALL_USERS'] %}
|
||||
<li><a href="/admin/users">Users Feed</a></li>
|
||||
{% endif %}
|
||||
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
||||
<li><a href="/admin/shadowbanned">Shadowbanned Users</a></li>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
|
||||
|
||||
{% if v and v.admin_level %}
|
||||
<a href="/admin/users">
|
||||
<a href="/users">
|
||||
<h5 class="text-center mb-4">
|
||||
Current registered users: {{current_registered_users()}}
|
||||
</h5>
|
||||
</a>
|
||||
{% else %}
|
||||
<h5 class="text-center mb-4">
|
||||
Current registered users: {{current_registered_users()}}
|
||||
</h5>
|
||||
{% endif %}
|
||||
|
||||
{%- if v -%}
|
||||
{%- set art_image = macros.random_image("assets/images/" ~ SITE_NAME ~ "/sidebar") -%}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
|
||||
|
||||
{% if v and v.admin_level %}
|
||||
<a href="/admin/users">
|
||||
<a href="/users">
|
||||
<h5 class="text-center mb-4">
|
||||
Current registered users: {{current_registered_users()}}
|
||||
</h5>
|
||||
</a>
|
||||
{% else %}
|
||||
<h5 class="text-center mb-4">
|
||||
Current registered users: {{current_registered_users()}}
|
||||
</h5>
|
||||
{% endif %}
|
||||
|
||||
{% if sub %}
|
||||
{% set image=sub.sidebar_url %}
|
||||
|
|
Loading…
Reference in New Issue