mirror of
https://github.com/thelounge/thelounge
synced 2024-11-14 00:07:17 +00:00
Fill inputhistory on channel load and more message load
This commit is contained in:
parent
bd4e821614
commit
11aa52687c
2 changed files with 15 additions and 1 deletions
|
@ -12,6 +12,13 @@ socket.on("more", function (data) {
|
|||
return;
|
||||
}
|
||||
|
||||
channel.inputHistory = channel.inputHistory.concat(
|
||||
data.messages
|
||||
.filter((m) => m.self && m.text && m.type === "message")
|
||||
.map((m) => m.text)
|
||||
.reverse()
|
||||
.slice(null, 100 - channel.inputHistory.length)
|
||||
);
|
||||
channel.moreHistoryAvailable =
|
||||
data.totalMessages > channel.messages.length + data.messages.length;
|
||||
channel.messages.unshift(...data.messages);
|
||||
|
|
|
@ -160,7 +160,14 @@ const store = new Vuex.Store({
|
|||
// TODO: This should be a mutation
|
||||
channel.pendingMessage = "";
|
||||
channel.inputHistoryPosition = 0;
|
||||
channel.inputHistory = [""];
|
||||
|
||||
channel.inputHistory = [""].concat(
|
||||
channel.messages
|
||||
.filter((m) => m.self && m.text && m.type === "message")
|
||||
.map((m) => m.text)
|
||||
.reverse()
|
||||
.slice(null, 99)
|
||||
);
|
||||
channel.historyLoading = false;
|
||||
channel.scrolledToBottom = true;
|
||||
channel.editTopic = false;
|
||||
|
|
Loading…
Reference in a new issue