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
This commit is contained in:
Joffrey JAFFEUX 2019-11-28 11:27:36 +01:00 committed by GitHub
parent 7fc99f5e7b
commit e92e06c3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,11 +33,21 @@ createWidget("quick-access-item", {
return result; 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 = `<span data-topic-id="${topicId}">${content}</span>`;
}
}
return h("a", { attributes: { href } }, [ return h("a", { attributes: { href } }, [
iconNode(icon), iconNode(icon),
new RawHtml({ new RawHtml({
html: `<div>${this._usernameHtml()}${this._contentHtml()}</div>` html: `<div>${this._usernameHtml()}${content}</div>`
}) })
]); ]);
}, },