def send_zulip(sender: UserProfile, stream: Stream, topic: str, content: str) -> None: internal_send_stream_message(stream.realm, sender, stream, truncate_topic(topic), truncate_body(content), email_gateway=True)
def send_zulip(sender: str, stream: Stream, topic: str, content: str) -> None: internal_send_message( stream.realm, sender, "stream", stream.name, truncate_topic(topic), truncate_body(content), email_gateway=True)
def send_zulip(sender: str, stream: Stream, topic: str, content: str) -> None: # Truncate the topic truncated_topic = truncate_topic(topic) # If the topic was truncated, add the topic to the front of the message if (len(truncated_topic) < len(topic) and not Message.objects.filter( subject=truncate_topic(topic), recipient=get_stream_recipient(stream.id), date_sent__lte=datetime.datetime.today(), date_sent__gt=datetime.datetime.today() - datetime.timedelta(days=7) ).exists()): content = "Subject: {}\n\n{}".format(topic, content) internal_send_message( stream.realm, sender, "stream", stream.name, truncated_topic, truncate_body(content), email_gateway=True)