FIX: adds data-topic-id to quick-access-item (#8422)

This fix will allow discourse-encrypt to decrypt messages titles of the quick-access-pannel for PMs
This commit is contained in:
Joffrey JAFFEUX 2019-11-28 06:29:17 +01:00 committed by Sam
parent b120728999
commit 700bd280e4

View File

@ -33,11 +33,19 @@ createWidget("quick-access-item", {
return result;
},
html({ icon, href }) {
html({ href, icon }) {
let content = this._contentHtml();
let topicId = href.match(/\/t\/.*?\/(\d+)/);
if (topicId && topicId[1]) {
topicId = escapeExpression(topicId[1]);
content = `<span data-topic-id="${topicId}">${content}</span>`;
}
return h("a", { attributes: { href } }, [
iconNode(icon),
new RawHtml({
html: `<div>${this._usernameHtml()}${this._contentHtml()}</div>`
html: `<div>${this._usernameHtml()}${content}</div>`
})
]);
},