add to emoji count when its used as a flag

master
Aevann 2024-10-19 12:27:10 +03:00
parent ead9e34bad
commit 57259857a3
1 changed files with 5 additions and 2 deletions

View File

@ -874,8 +874,8 @@ def settings_name_change(v):
@app.post("/settings/flag_change")
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@limiter.limit("3/day", deduct_when=lambda response: response.status_code < 400)
@limiter.limit("3/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def settings_flag_change(v):
new_flag = request.values.get("flag", "").strip(':').strip()
@ -890,6 +890,9 @@ def settings_flag_change(v):
v.flag = new_flag
g.db.add(v)
emoji.count += 1
g.db.add(emoji)
return {"message": "Your flag has been updated."}