2017-05-18 22:08:54 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const socket = require("../socket");
|
2019-11-03 15:59:43 +01:00
|
|
|
const {vueApp} = require("../vue");
|
|
|
|
const store = require("../store").default;
|
2017-05-18 22:08:54 +02:00
|
|
|
|
|
|
|
socket.on("more", function(data) {
|
2019-11-03 15:59:43 +01:00
|
|
|
const channel = store.getters.findChannel(data.chan);
|
2018-02-20 08:28:04 +01:00
|
|
|
|
2018-07-08 14:18:17 +02:00
|
|
|
if (!channel) {
|
|
|
|
return;
|
2017-05-18 22:08:54 +02:00
|
|
|
}
|
|
|
|
|
2019-10-17 12:27:15 +02:00
|
|
|
channel.channel.moreHistoryAvailable =
|
|
|
|
data.totalMessages > channel.channel.messages.length + data.messages.length;
|
2018-07-08 14:18:17 +02:00
|
|
|
channel.channel.messages.unshift(...data.messages);
|
2018-07-12 18:25:41 +02:00
|
|
|
|
|
|
|
vueApp.$nextTick(() => {
|
|
|
|
channel.channel.historyLoading = false;
|
|
|
|
});
|
2017-05-18 22:08:54 +02:00
|
|
|
});
|