forked from rDrama/rDrama
make log show 0 actions when u filter by a kind that doesn't exist
(instead of showing all actions)master
parent
5a0dccbd50
commit
d09634bf20
|
@ -126,8 +126,10 @@ def log(v):
|
|||
if v and v.admin_level > 1: types = ACTIONTYPES
|
||||
else: types = ACTIONTYPES2
|
||||
|
||||
if kind not in types: kind = None
|
||||
|
||||
if kind and kind not in types:
|
||||
kind = None
|
||||
actions = []
|
||||
else:
|
||||
actions = g.db.query(ModAction)
|
||||
if not (v and v.admin_level >= 2):
|
||||
actions = actions.filter(ModAction.kind.notin_(["shadowban","unshadowban"]))
|
||||
|
@ -142,9 +144,9 @@ def log(v):
|
|||
if kind: actions = actions.filter_by(kind=kind)
|
||||
|
||||
actions = actions.order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all()
|
||||
|
||||
next_exists=len(actions)>25
|
||||
actions=actions[:25]
|
||||
|
||||
admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level >= 2).order_by(User.username).all()]
|
||||
|
||||
return render_template("log.html", v=v, admins=admins, types=types, admin=admin, type=kind, actions=actions, next_exists=next_exists, page=page)
|
||||
|
|
Loading…
Reference in New Issue