Skip to content

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

DEV: Add `topic-list-item-expand-pinned` value transformer (#30537)

Isaac Janzenb1602d0e7fe0
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",
]);