thelounge/client/js/socket-events/msg_preview.js

21 lines
472 B
JavaScript
Raw Normal View History

2017-06-26 11:01:55 +02:00
"use strict";
2019-11-16 18:24:03 +01:00
import socket from "../socket";
import store from "../store";
2017-06-26 11:01:55 +02:00
socket.on("msg:preview", function (data) {
const {channel} = store.getters.findChannel(data.chan);
2018-07-10 13:57:11 +02:00
const message = channel.messages.find((m) => m.id === data.id);
if (!message) {
return;
}
const previewIndex = message.previews.findIndex((m) => m.link === data.preview.link);
if (previewIndex > -1) {
2021-03-29 04:55:35 +02:00
// TODO: Does this work?
message.previews[previewIndex] = data.preview;
2018-07-10 13:57:11 +02:00
}
2017-06-26 11:01:55 +02:00
});