From d6c43e853bd14504a40d06d1423147c97e801ae7 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 24 Sep 2017 04:51:31 +0000 Subject: [PATCH] Return normal titan logo if guest icon does not exist and av fixes --- webapp/titanembeds/blueprints/admin/admin.py | 2 +- webapp/titanembeds/blueprints/api/api.py | 4 ++-- webapp/titanembeds/blueprints/user/user.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/titanembeds/blueprints/admin/admin.py b/webapp/titanembeds/blueprints/admin/admin.py index 71f544d..326c403 100644 --- a/webapp/titanembeds/blueprints/admin/admin.py +++ b/webapp/titanembeds/blueprints/admin/admin.py @@ -180,7 +180,7 @@ def update_administrate_guild(guild_id): guest_icon = None db_guild.guest_icon = guest_icon db.session.commit() - emit("guest_icon_change", {"guest_icon": guest_icon}, room="GUILD_"+guild_id, namespace="/gateway") + emit("guest_icon_change", {"guest_icon": guest_icon if guest_icon else url_for('static', filename='img/titanembeds_square.png')}, room="GUILD_"+guild_id, namespace="/gateway") return jsonify( id=db_guild.id, guild_id=db_guild.guild_id, diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index e2655b4..089088e 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -359,8 +359,8 @@ def change_unauthenticated_username(): return response def get_guild_guest_icon(guild_id): - return db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first().guest_icon - + guest_icon = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first().guest_icon + return guest_icon if guest_icon else url_for('static', filename='img/titanembeds_square.png') def process_query_guild(guild_id, visitor=False): widget = discord_api.get_widget(guild_id) diff --git a/webapp/titanembeds/blueprints/user/user.py b/webapp/titanembeds/blueprints/user/user.py index 9738823..2fcd15b 100644 --- a/webapp/titanembeds/blueprints/user/user.py +++ b/webapp/titanembeds/blueprints/user/user.py @@ -243,7 +243,7 @@ def update_administrate_guild(guild_id): db_guild.guest_icon = guest_icon db.session.commit() - emit("guest_icon_change", {"guest_icon": guest_icon}, room="GUILD_"+guild_id, namespace="/gateway") + emit("guest_icon_change", {"guest_icon": guest_icon if guest_icon else url_for('static', filename='img/titanembeds_square.png')}, room="GUILD_"+guild_id, namespace="/gateway") return jsonify( id=db_guild.id, guild_id=db_guild.guild_id,