fixed a bug that caused 500 errors when jannies left the input area for days empty when they chudded someone

also removed some useless code for checking admin status on alts (why did I add this)
master
Aevann1 2022-05-30 05:30:32 +02:00
parent e5dbc9bfdd
commit de539ab7e5
1 changed files with 4 additions and 6 deletions

View File

@ -932,18 +932,16 @@ def admin_removed_comments(v):
def agendaposter(user_id, v):
user = g.db.query(User).filter_by(id=user_id).one_or_none()
days = min(float(request.values.get("days", 30.0)), 30.0)
days = request.values.get("days")
if not days: days = 30.0
days = float(days)
days = min(days, 30.0)
expiry = int(time.time() + days*60*60*24)
user.agendaposter = expiry
g.db.add(user)
for alt in user.alts:
if alt.admin_level: return {"error": "User is an admin!"}
alt.agendaposter = expiry
g.db.add(alt)
note = f"for {days} days"
ma = ModAction(