From b1602d0e7fe0e83c20911c073d8d76ea862fca06 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Thu, 2 Jan 2025 13:51:46 -0600 Subject: [PATCH] DEV: Add `topic-list-item-expand-pinned` value transformer (#30537) - Add `topic-list-item-expand-pinned` value transformer --- .../discourse/app/components/topic-list/item.gjs | 14 ++++++++++---- .../discourse/app/lib/transformer/registry.js | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs index cd18330c1dd..6a9f6a5c0a4 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs +++ b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs @@ -55,17 +55,23 @@ export default class Item extends Component { } get expandPinned() { + let expandPinned; if ( !this.args.topic.pinned || (this.site.mobileView && !this.siteSettings.show_pinned_excerpt_mobile) || (this.site.desktopView && !this.siteSettings.show_pinned_excerpt_desktop) ) { - return false; + expandPinned = false; + } else { + expandPinned = + (this.args.expandGloballyPinned && this.args.topic.pinned_globally) || + this.args.expandAllPinned; } - return ( - (this.args.expandGloballyPinned && this.args.topic.pinned_globally) || - this.args.expandAllPinned + return applyValueTransformer( + "topic-list-item-expand-pinned", + expandPinned, + { topic: this.args.topic, mobileView: this.site.mobileView } ); } diff --git a/app/assets/javascripts/discourse/app/lib/transformer/registry.js b/app/assets/javascripts/discourse/app/lib/transformer/registry.js index efc9d56af24..d0f42558f44 100644 --- a/app/assets/javascripts/discourse/app/lib/transformer/registry.js +++ b/app/assets/javascripts/discourse/app/lib/transformer/registry.js @@ -25,5 +25,6 @@ export const VALUE_TRANSFORMERS = Object.freeze([ "topic-list-header-sortable-column", "topic-list-class", "topic-list-item-class", + "topic-list-item-expand-pinned", "topic-list-item-mobile-layout", ]);