For the CUSTOMER3 realm, include 100 messages in initial message set.

This is an experiment to try to ease the customer3 onboarding process
given that there will be a website with a public feed of recent Zulip
messages, to ensure that those messages appear for new users.

(imported from commit 31fb59c1800728b5e4d8a5ce7282c7dcedb02b21)
This commit is contained in:
Tim Abbott 2013-08-09 15:34:50 -04:00 committed by Jessica McKellar
parent e2413e8137
commit f9c3f77d07

View File

@ -292,6 +292,19 @@ def accounts_register(request):
for stream in streams:
do_add_subscription(user_profile, stream)
# For the CUSTOMER3 realm, we're experimenting with
# including the last N messages to the home view on signup
if user_profile.realm.domain == "customer3.invalid":
recipients = Recipient.objects.filter(type=Recipient.STREAM,
type_id__in=[stream.id for stream in streams])
messages = Message.objects.filter(recipient_id__in=recipients).order_by("-id")[0:100]
if len(messages) > 0:
ums_to_create = [UserMessage(user_profile=user_profile, message=message,
flags=UserMessage.flags.read)
for message in messages]
UserMessage.objects.bulk_create(ums_to_create)
if prereg_user.referred_by is not None:
# This is a cross-realm private message.
internal_send_message("new-user-bot@zulip.com",