Remove obsolete internal_send_messages().

We have been phasing this out for a couple years,
and I fixed the last stragglers over the last
couple days.
This commit is contained in:
Steve Howell 2020-02-11 15:55:16 +00:00 committed by Tim Abbott
parent 2e8dec233e
commit 8c3eaeb872
2 changed files with 0 additions and 44 deletions

View File

@ -2515,36 +2515,6 @@ def internal_prep_private_message(realm: Realm,
content=content,
)
def internal_send_message(realm: Realm, sender_email: str, recipient_type_name: str,
recipients: str, topic_name: str, content: str) -> Optional[int]:
"""internal_send_message should only be used where `sender_email` is a
system bot."""
# Verify the user is in fact a system bot
assert(is_cross_realm_bot_email(sender_email) or sender_email == settings.ERROR_BOT)
sender = get_system_bot(sender_email)
parsed_recipients = extract_recipients(recipients)
addressee = Addressee.legacy_build(
sender,
recipient_type_name,
parsed_recipients,
topic_name,
realm=realm)
msg = _internal_prep_message(
realm=realm,
sender=sender,
addressee=addressee,
content=content,
)
if msg is None:
return None
message_ids = do_send_messages([msg])
return message_ids[0]
def internal_send_private_message(realm: Realm,
sender: UserProfile,
recipient_user: UserProfile,

View File

@ -33,7 +33,6 @@ from zerver.lib.actions import (
internal_prep_private_message,
internal_prep_stream_message_by_name,
internal_send_huddle_message,
internal_send_message,
internal_send_private_message,
internal_send_stream_message,
internal_send_stream_message_by_name,
@ -567,19 +566,6 @@ class InternalPrepTest(ZulipTestCase):
arg = m.call_args_list[0][0][0]
self.assertIn('Message must not be empty', arg)
with mock.patch('logging.exception') as m:
internal_send_message(
realm=realm,
sender_email=settings.ERROR_BOT,
recipient_type_name='stream',
recipients=stream.name,
topic_name='whatever',
content=bad_content,
)
arg = m.call_args_list[0][0][0]
self.assertIn('Message must not be empty', arg)
def test_error_handling(self) -> None:
realm = get_realm('zulip')
sender = self.example_user('cordelia')