From 44bff43c863fa75ea4bf464064c34cf87b9911d7 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Mon, 16 Oct 2017 20:05:00 +0000 Subject: [PATCH] actions.py: Rename `do_remove_reaction()` to `do_remove_reaction_legacy()`. --- zerver/lib/actions.py | 2 +- zerver/tests/test_events.py | 6 +++--- zerver/views/reactions.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 35e6777089..b72d78df25 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1344,7 +1344,7 @@ def do_add_reaction_legacy(user_profile, message, emoji_name): reaction.save() notify_reaction_update(user_profile, message, reaction, "add") -def do_remove_reaction(user_profile, message, emoji_name): +def do_remove_reaction_legacy(user_profile, message, emoji_name): # type: (UserProfile, Message, Text) -> None reaction = Reaction.objects.filter(user_profile=user_profile, message=message, diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index 445d8875ef..6239364018 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -50,7 +50,7 @@ from zerver.lib.actions import ( do_regenerate_api_key, do_remove_alert_words, do_remove_default_stream, - do_remove_reaction, + do_remove_reaction_legacy, do_remove_realm_domain, do_remove_realm_emoji, do_remove_realm_filter, @@ -761,7 +761,7 @@ class EventsRegisterTest(ZulipTestCase): error = schema_checker('events[0]', events[0]) self.assert_on_error(error) - def test_remove_reaction(self): + def test_remove_reaction_legacy(self): # type: () -> None schema_checker = self.check_events_dict([ ('type', equals('reaction')), @@ -781,7 +781,7 @@ class EventsRegisterTest(ZulipTestCase): message = Message.objects.get(id=message_id) do_add_reaction_legacy(self.user_profile, message, "tada") events = self.do_test( - lambda: do_remove_reaction( + lambda: do_remove_reaction_legacy( self.user_profile, message, "tada"), state_change_expected=False, ) diff --git a/zerver/views/reactions.py b/zerver/views/reactions.py index 2b66ec5a65..8f2624ad73 100644 --- a/zerver/views/reactions.py +++ b/zerver/views/reactions.py @@ -5,7 +5,8 @@ from typing import Text from zerver.decorator import authenticated_json_post_view,\ has_request_variables, REQ, to_non_negative_int -from zerver.lib.actions import do_add_reaction_legacy, do_remove_reaction +from zerver.lib.actions import do_add_reaction_legacy,\ + do_remove_reaction_legacy from zerver.lib.emoji import check_valid_emoji from zerver.lib.message import access_message from zerver.lib.request import JsonableError @@ -62,6 +63,6 @@ def remove_reaction_backend(request, user_profile, message_id, emoji_name): emoji_name=emoji_name).exists(): raise JsonableError(_("Reaction does not exist")) - do_remove_reaction(user_profile, message, emoji_name) + do_remove_reaction_legacy(user_profile, message, emoji_name) return json_success()