Update topic in channel state

This commit is contained in:
Pavel Djundik 2018-07-12 21:36:44 +03:00 committed by Pavel Djundik
parent e92f5d573b
commit 80a12d98b4
1 changed files with 6 additions and 6 deletions

View File

@ -1,12 +1,12 @@
"use strict"; "use strict";
const $ = require("jquery");
const socket = require("../socket"); const socket = require("../socket");
const helpers_parse = require("../libs/handlebars/parse"); const {findChannel} = require("../vue");
socket.on("topic", function(data) { socket.on("topic", function(data) {
const topic = $("#chan-" + data.chan).find(".header .topic"); let channel = findChannel(data.chan);
topic.html(helpers_parse(data.topic));
// .prop() is safe escape-wise but consider the capabilities of the attribute if (channel) {
topic.prop("title", data.topic); channel.channel.topic = data.topic;
}
}); });