Fix history not loading after trimming

This commit is contained in:
Pavel Djundik 2018-07-12 23:39:23 +03:00 committed by Pavel Djundik
parent 6a82114b62
commit b88a186d05
2 changed files with 6 additions and 1 deletions

View File

@ -131,7 +131,11 @@ window.vueMounted = () => {
if (lastChannel.messages.length > 0) { if (lastChannel.messages.length > 0) {
lastChannel.firstUnread = lastChannel.messages[lastChannel.messages.length - 1].id; lastChannel.firstUnread = lastChannel.messages[lastChannel.messages.length - 1].id;
}
if (lastChannel.messages.length > 100) {
lastChannel.messages.splice(0, lastChannel.messages.length - 100); lastChannel.messages.splice(0, lastChannel.messages.length - 100);
lastChannel.moreHistoryAvailable = true;
} }
} }

View File

@ -75,8 +75,9 @@ socket.on("msg", function(data) {
} }
} }
if (messageLimit > 0) { if (channel.messages.length > messageLimit) {
channel.messages.splice(0, channel.messages.length - messageLimit); channel.messages.splice(0, channel.messages.length - messageLimit);
channel.moreHistoryAvailable = true;
} }
if ((data.msg.type === "message" || data.msg.type === "action") && channel.type === "channel") { if ((data.msg.type === "message" || data.msg.type === "action") && channel.type === "channel") {