From 4580aed97c9747367c46454cd49730398e0a6ded Mon Sep 17 00:00:00 2001 From: Luna Mendes Date: Wed, 21 Nov 2018 21:01:56 -0300 Subject: [PATCH] channel.messages: simplify delete_message's check --- litecord/blueprints/channel/messages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litecord/blueprints/channel/messages.py b/litecord/blueprints/channel/messages.py index 36e7459..bf14ed1 100644 --- a/litecord/blueprints/channel/messages.py +++ b/litecord/blueprints/channel/messages.py @@ -314,7 +314,8 @@ async def delete_message(channel_id, message_id): by_ownership = author_id == user_id - if not by_perm and not by_ownership: + can_delete = by_perm or by_ownership + if not can_delete: raise Forbidden('You can not delete this message') await app.db.execute("""