actions.py: Rename `do_add_reaction()` to `do_add_reaction_legacy()`.

This commit is contained in:
Harshit Bansal 2017-10-16 20:02:20 +00:00 committed by Tim Abbott
parent 636046aec9
commit 233595b2f7
5 changed files with 12 additions and 12 deletions

View File

@ -1335,7 +1335,7 @@ def notify_reaction_update(user_profile, message, reaction, op):
ums = UserMessage.objects.filter(message=message.id)
send_event(event, [um.user_profile_id for um in ums])
def do_add_reaction(user_profile, message, emoji_name):
def do_add_reaction_legacy(user_profile, message, emoji_name):
# type: (UserProfile, Message, Text) -> None
(emoji_code, reaction_type) = emoji_name_to_emoji_code(user_profile.realm, emoji_name)
reaction = Reaction(user_profile=user_profile, message=message,

View File

@ -4,7 +4,7 @@ from django.conf import settings
from zerver.lib.actions import set_default_streams, bulk_add_subscriptions, \
internal_prep_stream_message, internal_send_private_message, \
create_stream_if_needed, create_streams_if_needed, do_send_messages, \
do_add_reaction
do_add_reaction_legacy
from zerver.models import Realm, UserProfile, Message, Reaction, get_system_bot
from typing import Any, Dict, List, Mapping, Text
@ -100,4 +100,4 @@ def send_initial_realm_messages(realm):
id__in=message_ids,
subject='topic demonstration',
content__icontains='cute/turtle.png')
do_add_reaction(welcome_bot, turtle_message, 'turtle')
do_add_reaction_legacy(welcome_bot, turtle_message, 'turtle')

View File

@ -25,7 +25,7 @@ from zerver.lib.actions import (
check_send_typing_notification,
do_add_alert_words,
do_add_default_stream,
do_add_reaction,
do_add_reaction_legacy,
do_add_realm_domain,
do_add_realm_filter,
do_change_avatar_fields,
@ -735,7 +735,7 @@ class EventsRegisterTest(ZulipTestCase):
state_change_expected=True,
)
def test_send_reaction(self):
def test_add_reaction_legacy(self):
# type: () -> None
schema_checker = self.check_events_dict([
('type', equals('reaction')),
@ -754,7 +754,7 @@ class EventsRegisterTest(ZulipTestCase):
message_id = self.send_stream_message(self.example_email("hamlet"), "Verona", "hello")
message = Message.objects.get(id=message_id)
events = self.do_test(
lambda: do_add_reaction(
lambda: do_add_reaction_legacy(
self.user_profile, message, "tada"),
state_change_expected=False,
)
@ -779,7 +779,7 @@ class EventsRegisterTest(ZulipTestCase):
message_id = self.send_stream_message(self.example_email("hamlet"), "Verona", "hello")
message = Message.objects.get(id=message_id)
do_add_reaction(self.user_profile, message, "tada")
do_add_reaction_legacy(self.user_profile, message, "tada")
events = self.do_test(
lambda: do_remove_reaction(
self.user_profile, message, "tada"),

View File

@ -5,7 +5,7 @@ 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, do_remove_reaction
from zerver.lib.actions import do_add_reaction_legacy, do_remove_reaction
from zerver.lib.emoji import check_valid_emoji
from zerver.lib.message import access_message
from zerver.lib.request import JsonableError
@ -43,7 +43,7 @@ def add_reaction_backend(request, user_profile, message_id, emoji_name):
if user_message is None:
create_historical_message(user_profile, message)
do_add_reaction(user_profile, message, emoji_name)
do_add_reaction_legacy(user_profile, message, emoji_name)
return json_success()

View File

@ -4,7 +4,7 @@
from django.core.management.base import BaseCommand
from zerver.lib.actions import create_stream_if_needed, \
internal_prep_stream_message, do_create_user, do_send_messages, \
do_add_reaction, bulk_add_subscriptions, do_change_avatar_fields
do_add_reaction_legacy, bulk_add_subscriptions, do_change_avatar_fields
from zerver.lib.upload import upload_avatar_image
from zerver.models import get_realm, UserProfile, Message
@ -87,7 +87,7 @@ From image editing program:
message_ids = do_send_messages(messages)
preview_message = Message.objects.get(id__in=message_ids, content__icontains='image previews')
do_add_reaction(starr, preview_message, 'whale')
do_add_reaction_legacy(starr, preview_message, 'whale')
twitter_message = Message.objects.get(id__in=message_ids, content__icontains='gvanrossum')
# Setting up a twitter integration in dev is a decent amount of work. If you need
@ -105,7 +105,7 @@ From image editing program:
# Put a short pause between the whale reaction and this, so that the
# thumbs_up shows up second
do_add_reaction(starr, preview_message, 'thumbs_up')
do_add_reaction_legacy(starr, preview_message, 'thumbs_up')
def handle(self, *args, **options):
# type: (*Any, **str) -> None