mirror of
https://github.com/thelounge/thelounge.git
synced 2026-04-18 04:50:40 -04:00
- Mentions were doing a bunch of mutations; not just uses derived state - no need for a separate `ClientMention` - added `extractInputHistory` for shared logic - tests made by claude
24 lines
638 B
TypeScript
24 lines
638 B
TypeScript
import {nextTick} from "vue";
|
|
|
|
import socket from "../socket";
|
|
import {store} from "../store";
|
|
import {extractInputHistory} from "../helpers/inputHistory";
|
|
|
|
socket.on("more", async (data) => {
|
|
const channel = store.getters.findChannel(data.chan)?.channel;
|
|
|
|
if (!channel) {
|
|
return;
|
|
}
|
|
|
|
channel.inputHistory = channel.inputHistory.concat(
|
|
extractInputHistory(data.messages, 100 - channel.inputHistory.length)
|
|
);
|
|
channel.moreHistoryAvailable =
|
|
data.totalMessages > channel.messages.length + data.messages.length;
|
|
channel.messages = data.messages.concat(channel.messages);
|
|
|
|
await nextTick();
|
|
channel.historyLoading = false;
|
|
});
|