mirror of https://github.com/zulip/zulip.git
The load old messages "button" is now gone.
load_old_messages cares whether it is acting on behalf of a narrow (for_narrow) not whether it is acting on behalf of a button push. (imported from commit 16c00e015478f94f0631e211a92a7066a38135a8)
This commit is contained in:
parent
50de4db2de
commit
6670cf7b55
|
@ -644,16 +644,16 @@ function get_updates(options) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_old_messages(anchor, num_before, num_after, cont, because_button,
|
function load_old_messages(anchor, num_before, num_after, cont, for_narrow,
|
||||||
cont_will_add_messages) {
|
cont_will_add_messages) {
|
||||||
var narrow_str;
|
var narrow_str;
|
||||||
if (because_button === undefined) {
|
if (for_narrow === undefined) {
|
||||||
because_button = false;
|
for_narrow = false;
|
||||||
}
|
}
|
||||||
if (cont_will_add_messages === undefined) {
|
if (cont_will_add_messages === undefined) {
|
||||||
cont_will_add_messages = false;
|
cont_will_add_messages = false;
|
||||||
}
|
}
|
||||||
if (because_button && narrow.active()) {
|
if (for_narrow) {
|
||||||
narrow_str = JSON.stringify(narrow.data());
|
narrow_str = JSON.stringify(narrow.data());
|
||||||
} else {
|
} else {
|
||||||
narrow_str = JSON.stringify({});
|
narrow_str = JSON.stringify({});
|
||||||
|
@ -670,7 +670,7 @@ function load_old_messages(anchor, num_before, num_after, cont, because_button,
|
||||||
// The server occationally returns no data during a
|
// The server occationally returns no data during a
|
||||||
// restart. Ignore those responses and try again
|
// restart. Ignore those responses and try again
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
load_old_messages(anchor, num_before, num_after, cont, because_button);
|
load_old_messages(anchor, num_before, num_after, cont, for_narrow);
|
||||||
}, 0);
|
}, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -678,8 +678,7 @@ function load_old_messages(anchor, num_before, num_after, cont, because_button,
|
||||||
$('#connection-error').hide();
|
$('#connection-error').hide();
|
||||||
|
|
||||||
if (data.messages.length !== 0 && !cont_will_add_messages) {
|
if (data.messages.length !== 0 && !cont_will_add_messages) {
|
||||||
var add_to_home = !narrow.active() || !because_button;
|
add_messages(data.messages, !for_narrow);
|
||||||
add_messages(data.messages, add_to_home);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cont !== undefined) {
|
if (cont !== undefined) {
|
||||||
|
@ -690,7 +689,7 @@ function load_old_messages(anchor, num_before, num_after, cont, because_button,
|
||||||
// We might want to be more clever here
|
// We might want to be more clever here
|
||||||
$('#connection-error').show();
|
$('#connection-error').show();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
load_old_messages(anchor, num_before, num_after, cont, because_button);
|
load_old_messages(anchor, num_before, num_after, cont, for_narrow);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -752,7 +751,7 @@ function load_more_messages() {
|
||||||
if (messages.length === batch_size + 1) {
|
if (messages.length === batch_size + 1) {
|
||||||
load_more_enabled = true;
|
load_more_enabled = true;
|
||||||
}
|
}
|
||||||
}, true);
|
}, narrow.active());
|
||||||
}
|
}
|
||||||
|
|
||||||
var watchdog_time = $.now();
|
var watchdog_time = $.now();
|
||||||
|
|
Loading…
Reference in New Issue