mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
Simplify the default_subscriptions code path.
(imported from commit 62894a5949621465fcfd8d25372316d7ab495252)
This commit is contained in:
@@ -548,9 +548,9 @@ def set_default_streams(realm, stream_names):
|
||||
stream, _ = create_stream_if_needed(realm, stream_name)
|
||||
DefaultStream.objects.create(stream=stream, realm=realm)
|
||||
|
||||
def add_default_subs(user_profile):
|
||||
for default in DefaultStream.objects.filter(realm=user_profile.realm):
|
||||
do_add_subscription(user_profile, default.stream)
|
||||
def get_default_subs(user_profile):
|
||||
return [default.stream for default in
|
||||
DefaultStream.objects.filter(realm=user_profile.realm)]
|
||||
|
||||
@transaction.commit_on_success
|
||||
def do_update_user_activity(user_profile, client, query, log_time):
|
||||
@@ -710,10 +710,9 @@ def do_finish_tutorial(user_profile):
|
||||
|
||||
streams = prereg_user.streams.all()
|
||||
if len(streams) == 0:
|
||||
add_default_subs(user_profile)
|
||||
else:
|
||||
for stream in streams:
|
||||
do_add_subscription(user_profile, stream)
|
||||
streams = get_default_subs(user_profile)
|
||||
for stream in streams:
|
||||
do_add_subscription(user_profile, stream)
|
||||
|
||||
def gather_subscriptions(user_profile):
|
||||
# For now, don't display subscriptions for private messages.
|
||||
|
||||
@@ -22,7 +22,7 @@ from zephyr.models import Message, UserProfile, Stream, Subscription, \
|
||||
from zephyr.lib.actions import do_add_subscription, do_remove_subscription, \
|
||||
do_change_password, create_mit_user_if_needed, do_change_full_name, \
|
||||
do_change_enable_desktop_notifications, do_change_enter_sends, \
|
||||
do_activate_user, add_default_subs, do_create_user, check_send_message, \
|
||||
do_activate_user, do_create_user, check_send_message, \
|
||||
log_subscription_property_change, internal_send_message, \
|
||||
create_stream_if_needed, gather_subscriptions, subscribed_to_stream, \
|
||||
update_user_presence, set_stream_color, get_stream_colors, update_message_flags, \
|
||||
|
||||
Reference in New Issue
Block a user