From 1c91ec2dfd784cb9d9e9322049d8ba94abb29042 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 30 Aug 2021 11:09:32 +0200 Subject: [PATCH] df --- files/routes/oauth.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/routes/oauth.py b/files/routes/oauth.py index b562f4c1f..a4f2af056 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -117,13 +117,13 @@ def admin_app_approve(v, aid): def admin_app_revoke(v, aid): app = g.db.query(OauthApp).filter_by(id=aid).first() + if app.id: + for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth) - for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth) + g.db.flush() + send_notification(NOTIFICATIONS_ACCOUNT, app.author, f"Your application `{app.app_name}` has been revoked.") - g.db.flush() - send_notification(NOTIFICATIONS_ACCOUNT, app.author, f"Your application `{app.app_name}` has been revoked.") - - g.db.delete(app) + g.db.delete(app) return {"message": f"App revoked"}