From 943a683d861a4d964fc7899f56cc2f56a1092663 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 5 Feb 2019 17:47:21 -0300 Subject: [PATCH] guild.emoji: check if update actually happened to emoji --- litecord/blueprints/guild/emoji.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litecord/blueprints/guild/emoji.py b/litecord/blueprints/guild/emoji.py index 85aa7e1..925adac 100644 --- a/litecord/blueprints/guild/emoji.py +++ b/litecord/blueprints/guild/emoji.py @@ -102,8 +102,14 @@ async def _patch_emoji(guild_id, emoji_id): await guild_perm_check(user_id, guild_id, 'manage_emojis') j = validate(await request.get_json(), PATCH_EMOJI) + emoji = await app.storage.get_emoji(emoji_id) + + # if emoji.name is still the same, we don't update anything + # or send ane events, just return the same emoji we'd send + # as if we updated it. + if j['name'] == emoji['name']: + return jsonify(emoji) - # TODO: check if it actually updated anything await app.db.execute(""" UPDATE guild_emoji SET name = $1