This commit is contained in:
2000-Trek 2023-11-25 00:13:17 +01:00
parent 2d6d14ebba
commit 84a46c8970

View file

@ -355,18 +355,18 @@ def create_app(test_config=None):
return make_response(json.dumps({"mode":"error","error":"170"})) return make_response(json.dumps({"mode":"error","error":"170"}))
else: else:
c.execute(f"INSERT OR IGNORE INTO tags (tagid, userid) VALUES ({tag_id}, ?)", [user]) c.execute(f"INSERT OR IGNORE INTO tags (tagid, userid) VALUES ({tag_id}, ?)", [user])
db.commit()
log(type="addtag", userid=user_id ,after=tag_id) log(type="addtag", userid=user_id ,after=tag_id)
finished = queue_item finished = queue_item
db.commit()
return make_response(json.dumps({"mode":"message","username":"{}".format(username),"message":"A tag was added"})) return make_response(json.dumps({"mode":"message","username":"{}".format(username),"message":"A tag was added"}))
elif state == "remove": elif state == "remove":
c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = ?)", [user]) c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = ?)", [user])
tags = c.fetchall() tags = c.fetchall()
if tags != []: if tags != []:
c.execute(f"DELETE FROM tags WHERE (tagid = {tag_id} AND userid = ?)", [user]) c.execute(f"DELETE FROM tags WHERE (tagid = {tag_id} AND userid = ?)", [user])
db.commit()
log(type="removetag", userid=user_id, before=tag_id) log(type="removetag", userid=user_id, before=tag_id)
finished = queue_item finished = queue_item
db.commit()
return make_response(json.dumps({"mode":"message","username":"{}".format(username),"message":"A tag was removed"})) return make_response(json.dumps({"mode":"message","username":"{}".format(username),"message":"A tag was removed"}))
else: else:
message = "054" message = "054"