mirror of https://github.com/zulip/zulip.git
Offer to bankrupt a user if they are way behind.
(imported from commit 5483bb548a55e6cbf788b71a8885b3c990b94b77)
This commit is contained in:
parent
06bff38655
commit
30ab99d765
|
@ -0,0 +1,15 @@
|
|||
<div class="modal hide" id="bankruptcy" tabindex="-1" role="dialog"
|
||||
aria-labelledby="bankruptcy-label" aria-hidden="true">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="bankruptcy-label">Welcome back</h3>
|
||||
</div>
|
||||
|
||||
<div id="bankruptcy-unread-count"></div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button id="yes-bankrupt" class="btn btn-primary" aria-hidden="true">Yes, please!</button>
|
||||
<button id="no-bankrupt" class="btn" data-dismiss="modal" aria-hidden="true">No, I'll catch up.</button>
|
||||
</div>
|
||||
</div>
|
|
@ -57,6 +57,7 @@ var page_params = {{ page_params }};
|
|||
{% include "zephyr/keyboard_shortcuts.html" %}
|
||||
{% include "zephyr/markdown_help.html" %}
|
||||
{% include "zephyr/invite_user.html" %}
|
||||
{% include "zephyr/bankruptcy.html" %}
|
||||
{% include "zephyr/logout.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1576,6 +1576,10 @@ $(function () {
|
|||
compose.cancel();
|
||||
});
|
||||
|
||||
$('#yes-bankrupt').click(function (e) {
|
||||
fast_forward_pointer(this);
|
||||
});
|
||||
|
||||
// initialize other stuff
|
||||
composebox_typeahead.initialize();
|
||||
search.initialize();
|
||||
|
|
|
@ -1058,6 +1058,22 @@ function load_old_messages(opts) {
|
|||
// get the initial message list
|
||||
$(function () {
|
||||
function load_more(messages) {
|
||||
|
||||
// Before trying to load anything: is this user way behind?
|
||||
var last_read_message = home_msg_list.get(home_msg_list.closest_id(page_params.initial_pointer));
|
||||
if (last_read_message !== undefined) {
|
||||
var now = new XDate().getTime() / 1000;
|
||||
var num_unread = unread.get_counts().home_unread_messages;
|
||||
|
||||
if ((num_unread > 500) &&
|
||||
(now - last_read_message.timestamp > 60 * 60 * 24 * 2)) { // 2 days.
|
||||
var unread_info = templates.render('bankruptcy_modal',
|
||||
{"unread_count": num_unread});
|
||||
$('#bankruptcy-unread-count').html(unread_info);
|
||||
$('#bankruptcy').modal('show');
|
||||
}
|
||||
}
|
||||
|
||||
// If we received the initially selected message, select it on the client side,
|
||||
// but not if the user has already selected another one during load.
|
||||
//
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{{! The unread count in the bankruptcy modal }}
|
||||
|
||||
<div class="modal-body">
|
||||
<p>It's been a while! Since you were last here, you received <b>{{unread_count}}</b> new messages.</p>
|
||||
<p>Do you want to skip to your latest messages?</p>
|
||||
</div>
|
Loading…
Reference in New Issue