From 8f6dbfeaf4aa29cfca63a1f6c948be972da63ad9 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 21 Sep 2019 15:54:57 +1000 Subject: [PATCH] show profile picture on bot delete page, clean up icon display code --- app/templates/bot/delete.html | 4 ++-- app/templates/home.html | 2 +- app/webui.py | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/templates/bot/delete.html b/app/templates/bot/delete.html index 90986b8..f997f1d 100644 --- a/app/templates/bot/delete.html +++ b/app/templates/bot/delete.html @@ -13,10 +13,10 @@
-
+

Are you sure you want to permanently delete this bot?

-

The account on {{ instance }} will remain open, but your bot will stop posting from it.

+

The account on {{ instance }} will remain open, but FediBooks will stop posting from it.

Cancel
diff --git a/app/templates/home.html b/app/templates/home.html index 65d824c..077e830 100644 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -19,7 +19,7 @@
{% for bot in bots %}
-
+
{% set handle_list = bot['handle'].split('@') %}
@{{ handle_list[1] }}@{{ handle_list[2] }}
diff --git a/app/webui.py b/app/webui.py index 5ec1038..6ba4490 100644 --- a/app/webui.py +++ b/app/webui.py @@ -70,12 +70,15 @@ def bot_delete(id): if bot_check(id): if request.method == 'GET': instance = id.split("@")[2] - return render_template("bot/delete.html", instance = instance) + c = mysql.connection.cursor() + c.execute("SELECT icon FROM bots WHERE handle = %s", (id,)) + icon = c.fetchone()[0] + return render_template("bot/delete.html", instance = instance, icon = icon) else: # delete bot by deleting its credentials # FK constraint will delete bot c = mysql.connection.cursor() - c.execute("SELECT `credentials_id` FROM `bots` WHERE `handle` = %s", (id,)) + c.execute("SELECT credentials_id FROM bots WHERE handle = %s", (id,)) credentials_id = c.fetchone()[0] c.execute("SELECT client_id, client_secret, secret FROM credentials WHERE id = %s", (credentials_id,)) credentials = c.fetchone()