mirror of https://github.com/zulip/zulip.git
bots: Pass realm to get_system_bot calls in email_mirror.
This commit is contained in:
parent
d45f3eecaa
commit
104139657b
|
@ -228,7 +228,9 @@ def send_mm_reply_to_stream(
|
|||
stream=stream.name, error=error.msg
|
||||
)
|
||||
internal_send_private_message(
|
||||
get_system_bot(settings.NOTIFICATION_BOT), user_profile, error_message
|
||||
get_system_bot(settings.NOTIFICATION_BOT, user_profile.realm_id),
|
||||
user_profile,
|
||||
error_message,
|
||||
)
|
||||
|
||||
|
||||
|
@ -326,7 +328,7 @@ def filter_footer(text: str) -> str:
|
|||
|
||||
|
||||
def extract_and_upload_attachments(message: EmailMessage, realm: Realm) -> str:
|
||||
user_profile = get_system_bot(settings.EMAIL_GATEWAY_BOT)
|
||||
user_profile = get_system_bot(settings.EMAIL_GATEWAY_BOT, realm.id)
|
||||
|
||||
attachment_links = []
|
||||
for part in message.walk():
|
||||
|
@ -422,7 +424,7 @@ def process_stream_message(to: str, message: EmailMessage) -> None:
|
|||
options["include_quotes"] = is_forwarded(subject_header)
|
||||
|
||||
body = construct_zulip_body(message, stream.realm, **options)
|
||||
send_zulip(get_system_bot(settings.EMAIL_GATEWAY_BOT), stream, subject, body)
|
||||
send_zulip(get_system_bot(settings.EMAIL_GATEWAY_BOT, stream.realm_id), stream, subject, body)
|
||||
logger.info(
|
||||
"Successfully processed email to %s (%s)",
|
||||
stream.name,
|
||||
|
|
|
@ -528,7 +528,7 @@ class TestEmailMirrorMessagesWithAttachments(ZulipTestCase):
|
|||
len(image_bytes),
|
||||
"image/png",
|
||||
image_bytes,
|
||||
get_system_bot(settings.EMAIL_GATEWAY_BOT),
|
||||
get_system_bot(settings.EMAIL_GATEWAY_BOT, stream.realm_id),
|
||||
target_realm=user_profile.realm,
|
||||
)
|
||||
|
||||
|
@ -571,7 +571,7 @@ class TestEmailMirrorMessagesWithAttachments(ZulipTestCase):
|
|||
len(image_bytes),
|
||||
"image/png",
|
||||
image_bytes,
|
||||
get_system_bot(settings.EMAIL_GATEWAY_BOT),
|
||||
get_system_bot(settings.EMAIL_GATEWAY_BOT, stream.realm_id),
|
||||
target_realm=user_profile.realm,
|
||||
)
|
||||
|
||||
|
@ -617,7 +617,7 @@ class TestEmailMirrorMessagesWithAttachments(ZulipTestCase):
|
|||
len(image_bytes),
|
||||
"image/png",
|
||||
image_bytes,
|
||||
get_system_bot(settings.EMAIL_GATEWAY_BOT),
|
||||
get_system_bot(settings.EMAIL_GATEWAY_BOT, stream.realm_id),
|
||||
target_realm=user_profile.realm,
|
||||
)
|
||||
|
||||
|
@ -977,7 +977,9 @@ class TestMissedMessageEmailMessages(ZulipTestCase):
|
|||
message.content,
|
||||
"Error sending message to stream announce via message notification email reply:\nOnly organization administrators can send to this stream.",
|
||||
)
|
||||
self.assertEqual(message.sender, get_system_bot(settings.NOTIFICATION_BOT))
|
||||
self.assertEqual(
|
||||
message.sender, get_system_bot(settings.NOTIFICATION_BOT, user_profile.realm_id)
|
||||
)
|
||||
|
||||
def test_missed_stream_message_email_response_tracks_topic_change(self) -> None:
|
||||
self.subscribe(self.example_user("hamlet"), "Denmark")
|
||||
|
|
Loading…
Reference in New Issue