mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-08 08:42:17 +02:00
18 lines
460 B
TypeScript
18 lines
460 B
TypeScript
import socket from "../socket";
|
|
import {store} from "../store";
|
|
|
|
socket.on("msg:preview", function (data) {
|
|
const netChan = store.getters.findChannel(data.chan);
|
|
const message = netChan?.channel.messages.find((m) => m.id === data.id);
|
|
|
|
if (!message || !message.previews) {
|
|
return;
|
|
}
|
|
|
|
const previewIndex = message.previews.findIndex((m) => m.link === data.preview.link);
|
|
|
|
if (previewIndex > -1) {
|
|
message.previews[previewIndex] = data.preview;
|
|
}
|
|
});
|