<commit_before>"use strict";

const $ = require("jquery");
const socket = require("../socket");
const helpers_parse = require("../libs/handlebars/parse");

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);
});<commit_msg>Update topic in channel state<commit_after>"use strict";

const socket = require("../socket");
const {findChannel} = require("../vue");

socket.on("topic", function(data) {
	let channel = findChannel(data.chan);

	if (channel) {
		channel.channel.topic = data.topic;
	}
});
{'fraction_non_alphanumeric': 0.1925287356321839, 'fraction_numerical': 0.0, 'mean_word_length': 5.060869565217391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1663630', 'n_tokens_mistral': 215, 'n_tokens_neox': 211, 'n_words': 52}