2017-05-18 20:08:54 +00:00
|
|
|
"use strict";
|
|
|
|
|
2019-11-11 21:39:09 +00:00
|
|
|
import Vue from "vue";
|
|
|
|
|
2019-11-16 17:24:03 +00:00
|
|
|
import socket from "../socket";
|
|
|
|
import store from "../store";
|
2017-05-18 20:08:54 +00:00
|
|
|
|
2020-03-21 20:55:36 +00:00
|
|
|
socket.on("more", function (data) {
|
2019-11-03 14:59:43 +00:00
|
|
|
const channel = store.getters.findChannel(data.chan);
|
2018-02-20 07:28:04 +00:00
|
|
|
|
2018-07-08 12:18:17 +00:00
|
|
|
if (!channel) {
|
|
|
|
return;
|
2017-05-18 20:08:54 +00:00
|
|
|
}
|
|
|
|
|
2019-10-17 10:27:15 +00:00
|
|
|
channel.channel.moreHistoryAvailable =
|
|
|
|
data.totalMessages > channel.channel.messages.length + data.messages.length;
|
2018-07-08 12:18:17 +00:00
|
|
|
channel.channel.messages.unshift(...data.messages);
|
2018-07-12 16:25:41 +00:00
|
|
|
|
2019-11-11 21:39:09 +00:00
|
|
|
Vue.nextTick(() => {
|
2018-07-12 16:25:41 +00:00
|
|
|
channel.channel.historyLoading = false;
|
|
|
|
});
|
2017-05-18 20:08:54 +00:00
|
|
|
});
|