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

- Add `topic-list-item-expand-pinned` value transformer
This commit is contained in:
Isaac Janzen 2025-01-02 13:51:46 -06:00 committed by GitHub
parent b3772e23bf
commit b1602d0e7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View File

@ -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 }
);
}

View File

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