From e92e06c3a7006a97bc09c90f40afc4a7452709ca Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 28 Nov 2019 11:27:36 +0100 Subject: [PATCH] FIX: adds data-topic-id to quick-access-item (#8430) This fix will allow discourse-encrypt to decrypt messages titles of the quick-access-pannel for PMs --- .../discourse/widgets/quick-access-item.js.es6 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/quick-access-item.js.es6 b/app/assets/javascripts/discourse/widgets/quick-access-item.js.es6 index a37200e5956..46b209d1af8 100644 --- a/app/assets/javascripts/discourse/widgets/quick-access-item.js.es6 +++ b/app/assets/javascripts/discourse/widgets/quick-access-item.js.es6 @@ -33,11 +33,21 @@ createWidget("quick-access-item", { return result; }, - html({ icon, href }) { + html({ href, icon }) { + let content = this._contentHtml(); + + if (href) { + let topicId = href.match(/\/t\/.*?\/(\d+)/); + if (topicId && topicId[1]) { + topicId = escapeExpression(topicId[1]); + content = `${content}`; + } + } + return h("a", { attributes: { href } }, [ iconNode(icon), new RawHtml({ - html: `
${this._usernameHtml()}${this._contentHtml()}
` + html: `
${this._usernameHtml()}${content}
` }) ]); },