FIX: Make tagsHtml callback respect tagName option (#173)

FIX: Make tagsHtml callback respect tagName option (#173)

Makes the assigned icon and label non-interactive in search results dropdown.

diff --git a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
index bb17ff8..544e8f1 100644
--- a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
+++ b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6
@@ -231,13 +231,16 @@ function initialize(api) {
 
   api.addDiscoveryQueryParam("assigned", { replace: true, refreshModel: true });
 
-  api.addTagsHtmlCallback((topic) => {
+  api.addTagsHtmlCallback((topic, params) => {
     const assignedTo = topic.get("assigned_to_user.username");
     if (assignedTo) {
       const assignedPath = topic.assignedToUserPath;
-      return `<a data-auto-route='true' class='assigned-to discourse-tag simple' href='${assignedPath}'>${iconHTML(
-        "user-plus"
-      )}${assignedTo}</a>`;
+      const tagName = params.tagName || "a";
+      const icon = iconHTML("user-plus");
+      const href =
+        tagName === "a" ? `href="${assignedPath}" data-auto-route="true"` : "";
+
+      return `<${tagName} class="assigned-to discourse-tag simple" ${href}>${icon}${assignedTo}</${tagName}>`;
     }
   });
 

GitHub sha: 4e657b97df21c1f35cc68e70f42cc3a332690652