From 80a12d98b4fb3c0938934f1dbdf4d261853724e7 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Thu, 12 Jul 2018 21:36:44 +0300 Subject: [PATCH] Update topic in channel state --- client/js/socket-events/topic.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/js/socket-events/topic.js b/client/js/socket-events/topic.js index e9284bdc..33e6d8b9 100644 --- a/client/js/socket-events/topic.js +++ b/client/js/socket-events/topic.js @@ -1,12 +1,12 @@ "use strict"; -const $ = require("jquery"); const socket = require("../socket"); -const helpers_parse = require("../libs/handlebars/parse"); +const {findChannel} = require("../vue"); socket.on("topic", function(data) { - const topic = $("#chan-" + data.chan).find(".header .topic"); - topic.html(helpers_parse(data.topic)); - // .prop() is safe escape-wise but consider the capabilities of the attribute - topic.prop("title", data.topic); + let channel = findChannel(data.chan); + + if (channel) { + channel.channel.topic = data.topic; + } });