mirror of
https://github.com/zulip/zulip.git
synced 2026-07-15 21:03:26 +08:00
addressee: Rename for_stream to for_stream_name.
The name for_stream_name is more appropriate here. The name for_stream is more suitable for a function that takes in a Stream object, which we're about to add.
This commit is contained in:
parent
970c7d1ddf
commit
4da28970fa
@ -1962,7 +1962,7 @@ def extract_emails(emails: Iterable[str]) -> List[str]:
|
||||
|
||||
def check_send_stream_message(sender: UserProfile, client: Client, stream_name: str,
|
||||
topic: str, body: str) -> int:
|
||||
addressee = Addressee.for_stream(stream_name, topic)
|
||||
addressee = Addressee.for_stream_name(stream_name, topic)
|
||||
message = check_message(sender, client, addressee, body)
|
||||
|
||||
return do_send_messages([message])[0]
|
||||
@ -2326,7 +2326,7 @@ def internal_prep_stream_message(realm: Realm, sender: UserProfile,
|
||||
"""
|
||||
See _internal_prep_message for details of how this works.
|
||||
"""
|
||||
addressee = Addressee.for_stream(stream_name, topic)
|
||||
addressee = Addressee.for_stream_name(stream_name, topic)
|
||||
|
||||
return _internal_prep_message(
|
||||
realm=realm,
|
||||
|
||||
@ -130,7 +130,7 @@ class Addressee:
|
||||
return Addressee.for_stream_id(stream_id, topic_name)
|
||||
|
||||
stream_name = cast(str, stream_name_or_id)
|
||||
return Addressee.for_stream(stream_name, topic_name)
|
||||
return Addressee.for_stream_name(stream_name, topic_name)
|
||||
elif message_type_name == 'private':
|
||||
if not message_to:
|
||||
raise JsonableError(_("Message must have recipients"))
|
||||
@ -145,7 +145,7 @@ class Addressee:
|
||||
raise JsonableError(_("Invalid message type"))
|
||||
|
||||
@staticmethod
|
||||
def for_stream(stream_name: str, topic: str) -> 'Addressee':
|
||||
def for_stream_name(stream_name: str, topic: str) -> 'Addressee':
|
||||
topic = validate_topic(topic)
|
||||
return Addressee(
|
||||
msg_type='stream',
|
||||
|
||||
@ -3448,7 +3448,7 @@ class CheckMessageTest(ZulipTestCase):
|
||||
self.make_stream(stream_name)
|
||||
topic_name = 'issue'
|
||||
message_content = 'whatever'
|
||||
addressee = Addressee.for_stream(stream_name, topic_name)
|
||||
addressee = Addressee.for_stream_name(stream_name, topic_name)
|
||||
ret = check_message(sender, client, addressee, message_content)
|
||||
self.assertEqual(ret['message'].sender.email, self.example_email("othello"))
|
||||
|
||||
@ -3471,7 +3471,7 @@ class CheckMessageTest(ZulipTestCase):
|
||||
client = make_client(name="test suite")
|
||||
stream_name = u'Россия'
|
||||
topic_name = 'issue'
|
||||
addressee = Addressee.for_stream(stream_name, topic_name)
|
||||
addressee = Addressee.for_stream_name(stream_name, topic_name)
|
||||
message_content = 'whatever'
|
||||
old_count = message_stream_count(parent)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user