parent
0cc9c4166b
commit
38584e2f8e
@ -125,13 +125,15 @@ function renderChannelMessages(data) {
|
|||||||
const documentFragment = buildChannelMessages($(document.createDocumentFragment()), data.id, data.type, data.messages);
|
const documentFragment = buildChannelMessages($(document.createDocumentFragment()), data.id, data.type, data.messages);
|
||||||
const channel = chat.find("#chan-" + data.id + " .messages").append(documentFragment);
|
const channel = chat.find("#chan-" + data.id + " .messages").append(documentFragment);
|
||||||
|
|
||||||
const template = $(templates.unread_marker());
|
renderUnreadMarker($(templates.unread_marker()), data.firstUnread, channel);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.firstUnread > 0) {
|
function renderUnreadMarker(template, firstUnread, channel) {
|
||||||
let first = channel.find("#msg-" + data.firstUnread);
|
if (firstUnread > 0) {
|
||||||
|
let first = channel.find("#msg-" + firstUnread);
|
||||||
|
|
||||||
if (!first.length) {
|
if (!first.length) {
|
||||||
template.data("unread-id", data.firstUnread);
|
template.data("unread-id", firstUnread);
|
||||||
channel.prepend(template);
|
channel.prepend(template);
|
||||||
} else {
|
} else {
|
||||||
const parent = first.parent();
|
const parent = first.parent();
|
||||||
@ -201,6 +203,9 @@ function renderNetworks(data, singleNetwork) {
|
|||||||
const container = chan.find(".messages");
|
const container = chan.find(".messages");
|
||||||
buildChannelMessages(container, channel.id, channel.type, channel.messages);
|
buildChannelMessages(container, channel.id, channel.type, channel.messages);
|
||||||
|
|
||||||
|
const unreadMarker = container.find(".unread-marker").data("unread-id", 0);
|
||||||
|
renderUnreadMarker(unreadMarker, channel.firstUnread, container);
|
||||||
|
|
||||||
if (container.find(".msg").length >= 100) {
|
if (container.find(".msg").length >= 100) {
|
||||||
container.find(".show-more").addClass("show");
|
container.find(".show-more").addClass("show");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user