Skip to content

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

DEV: Add icon aliases (#26300)

Jordan Vidrineaf22154d80a6
diff --git a/app/assets/javascripts/discourse-common/addon/lib/icon-library.js b/app/assets/javascripts/discourse-common/addon/lib/icon-library.js
index 8d3d8f3ffe1..e86d77f861e 100644
--- a/app/assets/javascripts/discourse-common/addon/lib/icon-library.js
+++ b/app/assets/javascripts/discourse-common/addon/lib/icon-library.js
@@ -51,6 +51,9 @@ export const REPLACEMENTS = {
"notification.reaction": "bell",
"notification.votes_released": "plus",
"notification.chat_quoted": "quote-right",
+ "user_menu.replies": "reply",
+ "user_menu.drafts": "pencil-alt",
+ "sidebar.all_categories": "list",
};
export function replaceIcon(source, destination) {
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/common/all-categories-section-link.hbs b/app/assets/javascripts/discourse/app/components/sidebar/common/all-categories-section-link.hbs
index 4e323758553..1d7d997de48 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/common/all-categories-section-link.hbs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/common/all-categories-section-link.hbs
@@ -3,5 +3,5 @@
@content={{i18n "sidebar.all_categories"}}
@route="discovery.categories"
@prefixType="icon"
- @prefixValue="list"
+ @prefixValue="sidebar.all_categories"
/>
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/user-menu/menu.js b/app/assets/javascripts/discourse/app/components/user-menu/menu.js
index eba51246a12..aaa2a5452f6 100644
--- a/app/assets/javascripts/discourse/app/components/user-menu/menu.js
+++ b/app/assets/javascripts/discourse/app/components/user-menu/menu.js
@@ -36,7 +36,7 @@ const CORE_TOP_TABS = [
class extends UserMenuTab {
id = "replies";
- icon = "reply";
+ icon = "user_menu.replies";
panelComponent = UserMenuRepliesNotificationsList;
notificationTypes = [
"mentioned",
diff --git a/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs b/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs
index a5a0f0c4f96..63a0d7bf90c 100644
--- a/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs
+++ b/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs
@@ -54,7 +54,7 @@
<li class="drafts">
<LinkTo @route="userActivity.drafts" @model={{this.currentUser}}>
- {{d-icon "pencil-alt"}}
+ {{d-icon "user_menu.drafts"}}
<span class="item-label">
{{#if this.currentUser.draft_count}}
{{i18n "drafts.label_with_count" count=this.currentUser.draft_count}}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js
index c4dcbf15259..2164b764d4b 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js
@@ -502,18 +502,18 @@ acceptance("User menu", function (needs) {
"invites link not shown when the user can't invite"
);
- const dratsLink = query("#quick-access-profile ul li.drafts a");
+ const draftsLink = query("#quick-access-profile ul li.drafts a");
assert.ok(
- dratsLink.href.endsWith("/u/eviltrout/activity/drafts"),
+ draftsLink.href.endsWith("/u/eviltrout/activity/drafts"),
"has a link to the drafts page of the user"
);
assert.strictEqual(
- dratsLink.textContent.trim(),
+ draftsLink.textContent.trim(),
I18n.t("drafts.label_with_count", { count: 13 }),
"drafts link has the right label with count of the user's drafts"
);
assert.ok(
- dratsLink.querySelector(".d-icon-pencil-alt"),
+ draftsLink.querySelector(".d-icon-user_menu\\.drafts"),
"drafts link has the right icon"
);