unread_ops: Add unread class to messages instead of a full rerender.

When user marks messages as unread, we used to rerender them but
that was not required since we only need to add `unread` class
to their `message_row` to achieve the same effect.
This commit is contained in:
Aman Agrawal
2023-04-21 02:04:06 +00:00
committed by Tim Abbott
parent c8f1325281
commit ace3ca80a8
2 changed files with 13 additions and 16 deletions

View File

@@ -1587,4 +1587,13 @@ export class MessageListView {
}
$row.removeClass("unread");
}
show_messages_as_unread(message_ids) {
const $table = rows.get_table(this.table_name);
const $rows_to_show_as_unread = $table.find(".message_row").filter((index, $row) => {
const message_id = Number.parseFloat($row.getAttribute("zid"));
return message_ids.includes(message_id);
});
$rows_to_show_as_unread.addClass("unread");
}
}