Skip to content

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

DEV: Add `post-menu-like-button-icon` value transformer (#35720)

Isaac Janzen055da4ac1607
diff --git a/frontend/discourse/app/components/post/menu/buttons/like.gjs b/frontend/discourse/app/components/post/menu/buttons/like.gjs
index 1c6725b786f..3010145a4c5 100644
--- a/frontend/discourse/app/components/post/menu/buttons/like.gjs
+++ b/frontend/discourse/app/components/post/menu/buttons/like.gjs
@@ -41,6 +41,11 @@ export default class PostMenuLikeButton extends Component {
: "post.controls.like";
}
+ get likeButtonIcon() {
+ const defaultIcon = this.args.post.liked ? "d-liked" : "d-unliked";
+ return applyValueTransformer("post-menu-like-button-icon", defaultIcon);
+ }
+
@action
async toggleLike() {
this.isAnimated = true;
@@ -75,7 +80,7 @@ export default class PostMenuLikeButton extends Component {
data-post-id={{@post.id}}
disabled={{this.disabled}}
@action={{this.toggleLike}}
- @icon={{if @post.liked "d-liked" "d-unliked"}}
+ @icon={{this.likeButtonIcon}}
@label={{if @showLabel "post.controls.like_action"}}
@title={{this.title}}
/>
diff --git a/frontend/discourse/app/lib/transformer/registry.js b/frontend/discourse/app/lib/transformer/registry.js
index 0f5b5ea809a..1bda69b26c6 100644
--- a/frontend/discourse/app/lib/transformer/registry.js
+++ b/frontend/discourse/app/lib/transformer/registry.js
@@ -60,6 +60,7 @@ export const VALUE_TRANSFORMERS = Object.freeze([
"post-flag-title",
"post-menu-buttons",
"post-menu-collapsed",
+ "post-menu-like-button-icon",
"post-meta-data-edits-indicator-label",
"post-meta-data-infos",
"post-meta-data-poster-name-suppress-similar-name",