From d35e5082e5f2e2cfb81bf457f1f2ca44da5dda79 Mon Sep 17 00:00:00 2001 From: Juan David Martinez Date: Fri, 7 Mar 2025 20:39:04 -0500 Subject: [PATCH] fix linting issues --- .../initializers/extend-for-assigns.js | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/assets/javascripts/discourse/initializers/extend-for-assigns.js b/assets/javascripts/discourse/initializers/extend-for-assigns.js index 5c6ab7a..bba158e 100644 --- a/assets/javascripts/discourse/initializers/extend-for-assigns.js +++ b/assets/javascripts/discourse/initializers/extend-for-assigns.js @@ -469,57 +469,57 @@ function initialize(api) { .filter(({ assignee }) => assignee) .flat(); - if (!assignedTo) { - return ""; - } - - const createTagHtml = ({ assignee, note }) => { - let assignedPath; - if (assignee.assignedToPostId) { - assignedPath = `/p/${assignee.assignedToPostId}`; - } else { - assignedPath = `/t/${topic.id}`; - } - - const icon = iconHTML(assignee.username ? "user-plus" : "group-plus"); - let name; - name = - siteSettings.prioritize_full_name_in_ux || !assignee.username - ? assignee.name || assignee.username - : assignee.username; + if (!assignedTo) { + return ""; + } - const tagName = params.tagName || "a"; - const href = - tagName === "a" - ? `href="${getURL(assignedPath)}" data-auto-route="true"` - : ""; - - return `<${tagName} class="assigned-to discourse-tag simple" ${href}>${icon}${name}`; - }; - - // is there's one assignment just return the tag - if (assignedTo.length === 1) { - return createTagHtml(assignedTo[0]); + const createTagHtml = ({ assignee, note }) => { + let assignedPath; + if (assignee.assignedToPostId) { + assignedPath = `/p/${assignee.assignedToPostId}`; + } else { + assignedPath = `/t/${topic.id}`; } - - // join multiple assignments with a separator - let result = ""; - assignedTo.forEach((assignment, index) => { - result += createTagHtml(assignment); - - // add separator if not the last tag - if (index < assignedTo.length - 1) { - const separator = applyValueTransformer("tag-separator", ",", { - topic, - index, - }); - result += `${separator}`; - } - }); - - return result; + + const icon = iconHTML(assignee.username ? "user-plus" : "group-plus"); + let name; + name = + siteSettings.prioritize_full_name_in_ux || !assignee.username + ? assignee.name || assignee.username + : assignee.username; + + const tagName = params.tagName || "a"; + const href = + tagName === "a" + ? `href="${getURL(assignedPath)}" data-auto-route="true"` + : ""; + + return `<${tagName} class="assigned-to discourse-tag simple" ${href}>${icon}${name}`; + }; + + // is there's one assignment just return the tag + if (assignedTo.length === 1) { + return createTagHtml(assignedTo[0]); + } + + // join multiple assignments with a separator + let result = ""; + assignedTo.forEach((assignment, index) => { + result += createTagHtml(assignment); + + // add separator if not the last tag + if (index < assignedTo.length - 1) { + const separator = applyValueTransformer("tag-separator", ",", { + topic, + index, + }); + result += `${separator}`; + } + }); + + return result; }); api.createWidget("assigned-to-post", {