mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
Eliminate PMs to non-subscribers when creating streams.
This should make stream creation relatively fast again, since we will no longer send O(N) PMs out to tell folks the stream was created.
This commit is contained in:
@@ -1364,7 +1364,6 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
||||
"""
|
||||
invitee = "iago@zulip.com"
|
||||
invitee_full_name = 'Iago'
|
||||
|
||||
current_stream = self.get_streams(invitee)[0]
|
||||
invite_streams = self.make_random_stream_names([current_stream])[:1]
|
||||
@@ -1378,13 +1377,6 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||
)
|
||||
self.assert_json_success(result)
|
||||
|
||||
msg = self.get_second_to_last_message()
|
||||
self.assertEqual(msg.recipient.type, Recipient.PERSONAL)
|
||||
self.assertEqual(msg.sender_id, self.notification_bot().id)
|
||||
|
||||
expected_msg = "Hi there! %s just created a new stream #**%s**." % (invitee_full_name, invite_streams[0])
|
||||
self.assertEqual(msg.content, expected_msg)
|
||||
|
||||
def test_successful_subscriptions_notifies_stream(self):
|
||||
# type: () -> None
|
||||
"""
|
||||
|
||||
@@ -330,26 +330,6 @@ def add_subscriptions_backend(request, user_profile,
|
||||
topic=topic,
|
||||
content=msg))
|
||||
|
||||
else:
|
||||
msg = ("Hi there! %s just created a new stream #**%s**."
|
||||
% (user_profile.full_name, created_streams[0].name))
|
||||
|
||||
sender = get_user_profile_by_email(settings.NOTIFICATION_BOT)
|
||||
for realm_user_dict in get_active_user_dicts_in_realm(user_profile.realm):
|
||||
# Don't announce to yourself or to people you explicitly added
|
||||
# (who will get the notification above instead).
|
||||
if realm_user_dict['email'] in principals or realm_user_dict['email'] == user_profile.email:
|
||||
continue
|
||||
|
||||
recipient_email = realm_user_dict['email']
|
||||
|
||||
notifications.append(
|
||||
internal_prep_private_message(
|
||||
realm=user_profile.realm,
|
||||
sender=sender,
|
||||
recipient_email=recipient_email,
|
||||
content=msg))
|
||||
|
||||
if not user_profile.realm.is_zephyr_mirror_realm:
|
||||
for stream in created_streams:
|
||||
notifications.append(prep_stream_welcome_message(stream))
|
||||
|
||||
Reference in New Issue
Block a user