reactions.py: Don't check for valid emoji name while removing reaction.

On receiving a request for deleting a reaction, just check if such
a reaction exists or not. If it exists then just delete the reaction
otherwise send an error message that such a reaction doesn't exist.
It doesn't make sense to check whether an emoji name is valid or not.
This commit is contained in:
Harshit Bansal
2017-10-08 13:42:41 +00:00
parent 71eee35bce
commit 3acaa79336
2 changed files with 35 additions and 12 deletions

View File

@@ -51,8 +51,6 @@ def remove_reaction_backend(request, user_profile, message_id, emoji_name):
# cannot see the message (e.g. for messages to private streams).
message = access_message(user_profile, message_id)[0]
check_valid_emoji(message.sender.realm, emoji_name)
# We could probably just make this check be a try/except for the
# IntegrityError from it already existing, but this is a bit cleaner.
if not Reaction.objects.filter(user_profile=user_profile,