Skip to content

A platform for community discussion. Free, open, simple.

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

Joffrey JAFFEUXe92e06c3a700
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 = `<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>`
})
]);
},