This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/client/js/socket-events/msg_preview.js

22 lines
477 B
JavaScript
Raw Permalink Normal View History

"use strict";
import Vue from "vue";
import socket from "../socket";
import store from "../store";
socket.on("msg:preview", function (data) {
const {channel} = store.getters.findChannel(data.chan);
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) {
Vue.set(message.previews, previewIndex, data.preview);
}
});