email_mirror: Move ZulipEmailForwardUserError into email_mirror_helpers.

This commit is contained in:
Alex Vandiver 2021-08-31 21:46:34 +00:00 committed by Tim Abbott
parent 621d0e5123
commit be669c8d98
2 changed files with 5 additions and 4 deletions

View File

@ -17,6 +17,7 @@ from zerver.lib.actions import (
) )
from zerver.lib.email_mirror_helpers import ( from zerver.lib.email_mirror_helpers import (
ZulipEmailForwardError, ZulipEmailForwardError,
ZulipEmailForwardUserError,
decode_email_address, decode_email_address,
get_email_gateway_message_string_from_address, get_email_gateway_message_string_from_address,
) )
@ -199,10 +200,6 @@ def construct_zulip_body(
## Sending the Zulip ## ## Sending the Zulip ##
class ZulipEmailForwardUserError(ZulipEmailForwardError):
pass
def send_zulip(sender: UserProfile, stream: Stream, topic: str, content: str) -> None: def send_zulip(sender: UserProfile, stream: Stream, topic: str, content: str) -> None:
internal_send_stream_message( internal_send_stream_message(
sender, sender,

View File

@ -27,6 +27,10 @@ class ZulipEmailForwardError(Exception):
pass pass
class ZulipEmailForwardUserError(ZulipEmailForwardError):
pass
def get_email_gateway_message_string_from_address(address: str) -> str: def get_email_gateway_message_string_from_address(address: str) -> str:
pattern_parts = [re.escape(part) for part in settings.EMAIL_GATEWAY_PATTERN.split("%s")] pattern_parts = [re.escape(part) for part in settings.EMAIL_GATEWAY_PATTERN.split("%s")]
if settings.EMAIL_GATEWAY_EXTRA_PATTERN_HACK: if settings.EMAIL_GATEWAY_EXTRA_PATTERN_HACK: