Files
thelounge/client/js/socket-events/more.ts
Max Leiter eb75c4b77c chore: refactor Mentions, add isIgnoredUser util (#5051)
- 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
2026-04-11 07:59:14 -07:00

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;
});