mirror of https://github.com/zulip/zulip.git
notification bot: Update stream announcement message.
This commit is contained in:
parent
e8e420bbd9
commit
0f3c2748dd
|
@ -120,7 +120,8 @@ IGNORED_PHRASES = [
|
|||
r"in 3 hours",
|
||||
# We should probably just delete this string from translations
|
||||
r'activation key',
|
||||
# this is used as a topic
|
||||
# these are used as topics
|
||||
r'^new streams$',
|
||||
r'^stream events$',
|
||||
# These are used as example short names (e.g. an uncapitalized context):
|
||||
r"^marketing$",
|
||||
|
|
|
@ -2075,7 +2075,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
msg = self.get_second_to_last_message()
|
||||
self.assertEqual(msg.recipient.type, Recipient.STREAM)
|
||||
self.assertEqual(msg.sender_id, self.notification_bot().id)
|
||||
expected_msg = "@_**%s|%d** just created a new stream #**%s**." % (invitee_full_name, invitee_user.id, invite_streams[0])
|
||||
expected_msg = "@_**%s|%d** created a new stream #**%s**." % (invitee_full_name, invitee_user.id, invite_streams[0])
|
||||
self.assertEqual(msg.content, expected_msg)
|
||||
|
||||
def test_successful_cross_realm_notification(self) -> None:
|
||||
|
@ -2113,7 +2113,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
self.assertEqual(msg.recipient.type, Recipient.STREAM)
|
||||
self.assertEqual(msg.sender_id, self.notification_bot().id)
|
||||
stream_id = Stream.objects.latest('id').id
|
||||
expected_rendered_msg = '<p><span class="user-mention silent" data-user-id="%d">%s</span> just created a new stream <a class="stream" data-stream-id="%d" href="/#narrow/stream/%s-%s">#%s</a>.</p>' % (
|
||||
expected_rendered_msg = '<p><span class="user-mention silent" data-user-id="%d">%s</span> created a new stream <a class="stream" data-stream-id="%d" href="/#narrow/stream/%s-%s">#%s</a>.</p>' % (
|
||||
user.id, user.full_name, stream_id, stream_id, invite_streams[0], invite_streams[0])
|
||||
self.assertEqual(msg.rendered_content, expected_rendered_msg)
|
||||
|
||||
|
@ -2143,7 +2143,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
|
||||
msg = self.get_second_to_last_message()
|
||||
self.assertEqual(msg.sender_id, self.notification_bot().id)
|
||||
expected_msg = "@_**%s|%d** just created a new stream #**%s**." % (invitee_full_name, invitee_user.id, invite_streams[0])
|
||||
expected_msg = "@_**%s|%d** created a new stream #**%s**." % (invitee_full_name, invitee_user.id, invite_streams[0])
|
||||
self.assertEqual(msg.content, expected_msg)
|
||||
|
||||
def test_non_ascii_stream_subscription(self) -> None:
|
||||
|
|
|
@ -396,14 +396,16 @@ def add_subscriptions_backend(
|
|||
notifications_stream = user_profile.realm.get_notifications_stream()
|
||||
if notifications_stream is not None:
|
||||
if len(created_streams) > 1:
|
||||
stream_strs = ", ".join('#**%s**' % (s.name,) for s in created_streams)
|
||||
stream_msg = "the following streams: %s" % (stream_strs,)
|
||||
content = _("@_**%(user_name)s|%(user_id)d** created the following streams: %(stream_str)s.")
|
||||
else:
|
||||
stream_msg = "a new stream #**%s**." % (created_streams[0].name,)
|
||||
msg = ("@_**%s|%d** just created %s" % (user_profile.full_name, user_profile.id, stream_msg))
|
||||
content = _("@_**%(user_name)s|%(user_id)d** created a new stream %(stream_str)s.")
|
||||
content = content % {
|
||||
'user_name': user_profile.full_name,
|
||||
'user_id': user_profile.id,
|
||||
'stream_str': ", ".join('#**%s**' % (s.name,) for s in created_streams)}
|
||||
|
||||
sender = get_system_bot(settings.NOTIFICATION_BOT)
|
||||
topic = 'Streams'
|
||||
topic = _('new streams')
|
||||
|
||||
notifications.append(
|
||||
internal_prep_stream_message(
|
||||
|
@ -411,7 +413,7 @@ def add_subscriptions_backend(
|
|||
sender=sender,
|
||||
stream=notifications_stream,
|
||||
topic=topic,
|
||||
content=msg,
|
||||
content=content,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue