DEV: Support expand-pinned modifier in legacy topic-list (#30587)

This provides an easier upgrade path for themes/plugins. Matches the strategy used for other new topic-list-related modifiers.
This commit is contained in:
David Taylor 2025-01-06 22:33:36 +00:00 committed by GitHub
parent 116c3f7f8d
commit 210559edc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ import { observes, on } from "@ember-decorators/object";
import $ from "jquery";
import { topicTitleDecorators } from "discourse/components/topic-title";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import { applyValueTransformer } from "discourse/lib/transformer";
import DiscourseURL, { groupPath } from "discourse/lib/url";
import deprecated from "discourse-common/lib/deprecated";
import { RUNTIME_OPTIONS } from "discourse-common/lib/raw-handlebars-helpers";
@ -243,6 +244,17 @@ export default class TopicListItem extends Component {
@discourseComputed
expandPinned() {
return applyValueTransformer(
"topic-list-item-expand-pinned",
this._expandPinned,
{
topic: this.topic,
mobileView: this.site.mobileView,
}
);
}
get _expandPinned() {
const pinned = this.get("topic.pinned");
if (!pinned) {
return false;