Skip to content

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

DEV: add additional icon aliases for lock (#33547)

Kris92c9d43b9a69
diff --git a/app/assets/javascripts/discourse/app/components/bulk-select-topics-dropdown.gjs b/app/assets/javascripts/discourse/app/components/bulk-select-topics-dropdown.gjs
index 8d65963873f..3d8acb61a9b 100644
--- a/app/assets/javascripts/discourse/app/components/bulk-select-topics-dropdown.gjs
+++ b/app/assets/javascripts/discourse/app/components/bulk-select-topics-dropdown.gjs
@@ -82,7 +82,7 @@ export default class BulkSelectTopicsDropdown extends Component {
},
{
id: "close-topics",
- icon: "lock",
+ icon: "topic.closed",
name: i18n("topic_bulk_actions.close_topics.name"),
},
{
diff --git a/app/assets/javascripts/discourse/app/components/categories-boxes-topic.gjs b/app/assets/javascripts/discourse/app/components/categories-boxes-topic.gjs
index 93b6709a7be..caa9bde88bd 100644
--- a/app/assets/javascripts/discourse/app/components/categories-boxes-topic.gjs
+++ b/app/assets/javascripts/discourse/app/components/categories-boxes-topic.gjs
@@ -13,7 +13,7 @@ export default class CategoriesBoxesTopic extends Component {
return "thumbtack";
}
if (closed || archived) {
- return "lock";
+ return "category.restricted";
}
return "far-file-lines";
}
diff --git a/app/assets/javascripts/discourse/app/components/post/small-action.gjs b/app/assets/javascripts/discourse/app/components/post/small-action.gjs
index 9f53360678f..53c76b64475 100644
--- a/app/assets/javascripts/discourse/app/components/post/small-action.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/small-action.gjs
@@ -17,10 +17,10 @@ export const GROUP_ACTION_CODES = ["invited_group", "removed_group"];
export const customGroupActionCodes = [];
export const ICONS = {
- "closed.enabled": "lock",
- "closed.disabled": "unlock-keyhole",
- "autoclosed.enabled": "lock",
- "autoclosed.disabled": "unlock-keyhole",
+ "closed.enabled": "topic.closed",
+ "closed.disabled": "topic.opened",
+ "autoclosed.enabled": "topic.closed",
+ "autoclosed.disabled": "topic.opened",
"archived.enabled": "folder",
"archived.disabled": "folder-open",
"pinned.enabled": "thumbtack",
diff --git a/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs b/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs
index 0a0e73c0e96..1317bd15178 100644
--- a/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs
@@ -152,7 +152,7 @@ export default class TopicAdminMenu extends Component {
"topic.actions.close"
}}
@action={{fn this.onButtonAction "toggleClosed"}}
- @icon={{if @topic.closed "unlock" "lock"}}
+ @icon={{if @topic.closed "topic.opened" "topic.closed"}}
/>
</dropdown.item>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/components/topic-label-content.gjs b/app/assets/javascripts/discourse/app/components/topic-label-content.gjs
index abf9c3539fb..a42f080c8e9 100644
--- a/app/assets/javascripts/discourse/app/components/topic-label-content.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-label-content.gjs
@@ -26,7 +26,7 @@ const TopicLabelButton = <template>
{{#if @topic.closed}}
<span class="topic-status">
- {{icon "lock"}}
+ {{icon "topic.closed"}}
</span>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/components/topic-status.gjs b/app/assets/javascripts/discourse/app/components/topic-status.gjs
index e630725e749..ba759001dd2 100644
--- a/app/assets/javascripts/discourse/app/components/topic-status.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-status.gjs
@@ -43,17 +43,17 @@ export default class TopicStatus extends Component {
<span
title={{i18n "topic_statuses.locked_and_archived.help"}}
class="topic-status"
- >{{icon "lock"}}</span>
+ >{{icon "topic.closed"}}</span>
{{~else if @topic.closed~}}
<span
title={{i18n "topic_statuses.locked.help"}}
class="topic-status"
- >{{icon "lock"}}</span>
+ >{{icon "topic.closed"}}</span>
{{~else if @topic.archived~}}
<span
title={{i18n "topic_statuses.archived.help"}}
class="topic-status"
- >{{icon "lock"}}</span>
+ >{{icon "topic.closed"}}</span>
{{~/if~}}
{{~#if @topic.is_warning~}}
diff --git a/app/assets/javascripts/discourse/app/helpers/category-link.js b/app/assets/javascripts/discourse/app/helpers/category-link.js
index db8f58eb386..ab17db6947e 100644
--- a/app/assets/javascripts/discourse/app/helpers/category-link.js
+++ b/app/assets/javascripts/discourse/app/helpers/category-link.js
@@ -200,7 +200,7 @@ export function defaultCategoryLinkRenderer(category, opts) {
}
if (restricted) {
- html += iconHTML("lock");
+ html += iconHTML("category.restricted");
}
_extraIconRenderers.forEach((renderer) => {
const iconName = renderer(category);
diff --git a/app/assets/javascripts/discourse/app/lib/icon-library.js b/app/assets/javascripts/discourse/app/lib/icon-library.js
index a6011dbee49..1b7a9ad356e 100644
--- a/app/assets/javascripts/discourse/app/lib/icon-library.js
+++ b/app/assets/javascripts/discourse/app/lib/icon-library.js
@@ -55,6 +55,9 @@ export const REPLACEMENTS = {
"user_menu.replies": "reply",
"user_menu.drafts": "pencil",
"sidebar.all_categories": "list",
+ "topic.closed": "lock",
+ "topic.opened": "unlock",
+ "category.restricted": "lock",
};
export function replaceIcon(source, destination) {
diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js
index e41f5fc05f1..3b74f03da36 100644
--- a/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js
+++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js
@@ -230,7 +230,7 @@ export default class CategorySectionLink {
get prefixBadge() {
if (this.category.read_restricted) {
- return customCategoryLockIcon || "lock";
+ return customCategoryLockIcon || "category.restricted";
}
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js
index 30cb5176850..00cd706daf9 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js
@@ -482,7 +482,7 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
assert
.dom(
- `.sidebar-section-link-wrapper[data-category-id="${category3.id}"] .sidebar-section-link-prefix .prefix-badge.d-icon-lock`
+ `.sidebar-section-link-wrapper[data-category-id="${category3.id}"] .sidebar-section-link-prefix .prefix-badge[class*="d-icon-category.restricted"]`
)
.exists(
"category3 section link is rendered with lock prefix badge icon as it is read restricted"
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs
index 00eb8c90a2c..4c84bb013cd 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs
@@ -18,7 +18,7 @@ module("Integration | Component | Widget | topic-status", function (hooks) {
<template><MountWidget @widget="topic-status" @args={{args}} /></template>
);
- assert.dom(".topic-status .d-icon-lock").exists();
+ assert.dom(".topic-status [class*='d-icon-topic.closed']").exists();
});
test("toggling pin status", async function (assert) {
diff --git a/spec/system/page_objects/components/review/topic_link.rb b/spec/system/page_objects/components/review/topic_link.rb
index a67ec083ba7..096744c1693 100644
--- a/spec/system/page_objects/components/review/topic_link.rb
+++ b/spec/system/page_objects/components/review/topic_link.rb
@@ -7,7 +7,7 @@ module PageObjects
WRAPPER_CSS = ".post-topic"
def has_closed_topic_status?
- within(WRAPPER_CSS) { has_css?(".topic-status .d-icon-lock") }
+ within(WRAPPER_CSS) { has_css?(".topic-status [class*='d-icon-topic.closed']") }
end
def has_topic_link?(topic_title:, post_url:)
diff --git a/spec/system/page_objects/components/topic_list.rb b/spec/system/page_objects/components/topic_list.rb
index 1cc6225bf4d..73491e9c6e5 100644
--- a/spec/system/page_objects/components/topic_list.rb
+++ b/spec/system/page_objects/components/topic_list.rb
@@ -93,7 +93,7 @@ module PageObjects
private
def topic_list_item_closed(topic)
- "#{topic_list_item_class(topic)} .topic-statuses .topic-status svg.d-icon-lock"
+ "#{topic_list_item_class(topic)} .topic-statuses .topic-status svg[class*='d-icon-topic.closed']"
end
def topic_list_item_unread_badge(topic)
diff --git a/themes/horizon/scss/categories-view.scss b/themes/horizon/scss/categories-view.scss
index 617e51da803..19190dc40c3 100644
--- a/themes/horizon/scss/categories-view.scss
+++ b/themes/horizon/scss/categories-view.scss
@@ -57,7 +57,7 @@
align-items: center;
font-size: var(--font-up-1-rem);
- .d-icon:first-of-type:not(.d-icon-lock),
+ .d-icon:first-of-type:not([class*="d-icon-category.restricted"]),
&.--style-square::before,
&.--style-emoji .emoji {
width: 1.25em;
@@ -70,7 +70,7 @@
}
}
- .d-icon.d-icon-lock {
+ [class*="d-icon-category.restricted"] {
order: 1;
}
}
@@ -335,7 +335,7 @@
font-size: var(--font-up-1-rem);
}
- .d-icon:not(.d-icon-lock),
+ .d-icon:not([class*="d-icon-category.restricted"]),
img.emoji {
aspect-ratio: 1 / 1;
height: auto;