actions.py: Rename `do_remove_reaction()` to `do_remove_reaction_legacy()`.

This commit is contained in:
Harshit Bansal 2017-10-16 20:05:00 +00:00 committed by Tim Abbott
parent 233595b2f7
commit 44bff43c86
3 changed files with 7 additions and 6 deletions

View File

@ -1344,7 +1344,7 @@ def do_add_reaction_legacy(user_profile, message, emoji_name):
reaction.save() reaction.save()
notify_reaction_update(user_profile, message, reaction, "add") 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 # type: (UserProfile, Message, Text) -> None
reaction = Reaction.objects.filter(user_profile=user_profile, reaction = Reaction.objects.filter(user_profile=user_profile,
message=message, message=message,

View File

@ -50,7 +50,7 @@ from zerver.lib.actions import (
do_regenerate_api_key, do_regenerate_api_key,
do_remove_alert_words, do_remove_alert_words,
do_remove_default_stream, do_remove_default_stream,
do_remove_reaction, do_remove_reaction_legacy,
do_remove_realm_domain, do_remove_realm_domain,
do_remove_realm_emoji, do_remove_realm_emoji,
do_remove_realm_filter, do_remove_realm_filter,
@ -761,7 +761,7 @@ class EventsRegisterTest(ZulipTestCase):
error = schema_checker('events[0]', events[0]) error = schema_checker('events[0]', events[0])
self.assert_on_error(error) self.assert_on_error(error)
def test_remove_reaction(self): def test_remove_reaction_legacy(self):
# type: () -> None # type: () -> None
schema_checker = self.check_events_dict([ schema_checker = self.check_events_dict([
('type', equals('reaction')), ('type', equals('reaction')),
@ -781,7 +781,7 @@ class EventsRegisterTest(ZulipTestCase):
message = Message.objects.get(id=message_id) message = Message.objects.get(id=message_id)
do_add_reaction_legacy(self.user_profile, message, "tada") do_add_reaction_legacy(self.user_profile, message, "tada")
events = self.do_test( events = self.do_test(
lambda: do_remove_reaction( lambda: do_remove_reaction_legacy(
self.user_profile, message, "tada"), self.user_profile, message, "tada"),
state_change_expected=False, state_change_expected=False,
) )

View File

@ -5,7 +5,8 @@ from typing import Text
from zerver.decorator import authenticated_json_post_view,\ from zerver.decorator import authenticated_json_post_view,\
has_request_variables, REQ, to_non_negative_int 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.emoji import check_valid_emoji
from zerver.lib.message import access_message from zerver.lib.message import access_message
from zerver.lib.request import JsonableError 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(): emoji_name=emoji_name).exists():
raise JsonableError(_("Reaction does not exist")) 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() return json_success()