mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
Send some messages to warm up the first user in a realm.
(imported from commit b4d92d474b27c9a0eabf99576a0f441a7d919106)
This commit is contained in:
@@ -184,6 +184,20 @@ var fake_messages = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function send_delayed_stream_message(stream, topic, content, delay) {
|
||||||
|
setTimeout(function () {
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
url: '/json/tutorial_send_message',
|
||||||
|
type: 'POST',
|
||||||
|
data: {'type': 'stream',
|
||||||
|
'recipient': stream,
|
||||||
|
'topic': topic,
|
||||||
|
'content': content}
|
||||||
|
});
|
||||||
|
}, delay * 1000); // delay is in seconds.
|
||||||
|
}
|
||||||
|
|
||||||
function hide_app_alert() {
|
function hide_app_alert() {
|
||||||
$('#alert-bar-container').slideUp(100);
|
$('#alert-bar-container').slideUp(100);
|
||||||
}
|
}
|
||||||
@@ -336,6 +350,17 @@ function finale() {
|
|||||||
if (stream_data.in_home_view(page_params.notifications_stream)) {
|
if (stream_data.in_home_view(page_params.notifications_stream)) {
|
||||||
narrow.activate([["stream", page_params.notifications_stream]]);
|
narrow.activate([["stream", page_params.notifications_stream]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (page_params.first_in_realm) {
|
||||||
|
if (stream_data.in_home_view("engineering")) {
|
||||||
|
send_delayed_stream_message("engineering", "projects", "This is a message on stream **engineering** with the topic **projects**. Practice sending sending some messages here, or creating a new topic.", 10);
|
||||||
|
send_delayed_stream_message("engineering", "projects", "You might also enjoy:\n* Our lightweight formatting\n* emoji :thumbsup:\n* Our [desktop and mobile apps](/apps)", 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream_data.in_home_view("social")) {
|
||||||
|
send_delayed_stream_message("social", "cute animals", "This is a message on stream **social** with the topic **cute animals**. Try uploading or pasting in some pictures. Here's a [guinea pig](https://humbug-user-uploads.s3.amazonaws.com/byqgM1qjol1mzje_KzeNRT5F/guinea.jpg) to get you started:", 25);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reply() {
|
function reply() {
|
||||||
|
|||||||
@@ -785,9 +785,10 @@ def home(request):
|
|||||||
needs_tutorial = settings.TUTORIAL_ENABLED and \
|
needs_tutorial = settings.TUTORIAL_ENABLED and \
|
||||||
user_profile.tutorial_status != UserProfile.TUTORIAL_FINISHED
|
user_profile.tutorial_status != UserProfile.TUTORIAL_FINISHED
|
||||||
|
|
||||||
|
first_in_realm = realm_user_count(user_profile.realm) == 1
|
||||||
# If you are the only person in the realm and you didn't invite
|
# If you are the only person in the realm and you didn't invite
|
||||||
# anyone, we'll continue to encourage you to do so on the frontend.
|
# anyone, we'll continue to encourage you to do so on the frontend.
|
||||||
prompt_for_invites = (realm_user_count(user_profile.realm) == 1) and \
|
prompt_for_invites = first_in_realm and \
|
||||||
not PreregistrationUser.objects.filter(referred_by=user_profile).count()
|
not PreregistrationUser.objects.filter(referred_by=user_profile).count()
|
||||||
|
|
||||||
if user_profile.pointer == -1 and user_has_messages:
|
if user_profile.pointer == -1 and user_has_messages:
|
||||||
@@ -846,6 +847,7 @@ def home(request):
|
|||||||
referrals = register_ret['referrals'],
|
referrals = register_ret['referrals'],
|
||||||
realm_emoji = register_ret['realm_emoji'],
|
realm_emoji = register_ret['realm_emoji'],
|
||||||
needs_tutorial = needs_tutorial,
|
needs_tutorial = needs_tutorial,
|
||||||
|
first_in_realm = first_in_realm,
|
||||||
prompt_for_invites = prompt_for_invites,
|
prompt_for_invites = prompt_for_invites,
|
||||||
desktop_notifications_enabled = desktop_notifications_enabled,
|
desktop_notifications_enabled = desktop_notifications_enabled,
|
||||||
notifications_stream = notifications_stream,
|
notifications_stream = notifications_stream,
|
||||||
|
|||||||
Reference in New Issue
Block a user