mirror of https://github.com/zulip/zulip.git
Collapse new with old messages when prepending
(imported from commit 0279183c9a2c70b1fe42f60f4423327aaf2dc7b8)
This commit is contained in:
parent
6baacf6815
commit
8bc01c85f1
|
@ -20,7 +20,7 @@
|
|||
|
||||
{{#include_recipient}}
|
||||
{{#if is_class}}
|
||||
<tr>
|
||||
<tr class="recipient_row">
|
||||
<td colspan="2"
|
||||
class="zephyr_label_clickable zephyr_newstyle_class"
|
||||
onclick="select_zephyr_by_id({{id}}); narrow_class();">{{display_recipient}}</td>
|
||||
|
@ -28,7 +28,7 @@
|
|||
onclick="select_zephyr_by_id({{id}}); narrow_instance();">{{instance}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<tr class="recipient_row">
|
||||
<td colspan="3" class="zephyr_label_clickable zephyr_newstyle_pm"
|
||||
onclick="select_zephyr_by_id({{id}}); narrow_by_recipient();">Huddle with {{display_reply_to}}</td>
|
||||
</tr>
|
||||
|
|
|
@ -811,8 +811,29 @@ function add_to_table(zephyrs, table_name, filter_function, where) {
|
|||
var current_group = [];
|
||||
var new_message_groups = [];
|
||||
|
||||
if (where !== 'top')
|
||||
if (where === 'top') {
|
||||
// Assumption: We never get a 'top' update as the first update.
|
||||
|
||||
// Delete the current top message group, and add it back in with these
|
||||
// messages, in order to collapse properly.
|
||||
//
|
||||
// This means we redraw the entire view on each update when narrowed by
|
||||
// instance, which could be a problem down the line. For now we hope
|
||||
// that instance views will not be very big.
|
||||
|
||||
var top_group = message_groups[table_name][0];
|
||||
var top_messages = [];
|
||||
$.each(top_group, function (index, id) {
|
||||
get_zephyr_row(id, table_name).remove();
|
||||
top_messages.push(zephyr_dict[id]);
|
||||
});
|
||||
zephyrs = zephyrs.concat(top_messages);
|
||||
|
||||
// Delete the leftover recipient label.
|
||||
table.find('.recipient_row:first').remove();
|
||||
} else {
|
||||
prev = zephyr_dict[table.find('tr:last-child').attr('zid')];
|
||||
}
|
||||
|
||||
$.each(zephyrs, function (index, zephyr) {
|
||||
if (! filter_function(zephyr))
|
||||
|
|
Loading…
Reference in New Issue