DEV: Update modifyClass calls to native class syntax (#656)

This commit is contained in:
David Taylor 2024-12-02 13:22:35 +00:00 committed by GitHub
parent 6f682acae3
commit b8d50e9675
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 17 deletions

View File

@ -5,24 +5,27 @@ export default {
name: "disable-sort", name: "disable-sort",
initialize() { initialize() {
withPluginApi("0.8", (api) => { withPluginApi("0.8", (api) => {
api.modifyClass("component:topic-list", { api.modifyClass(
pluginId: "discourse-calendar", "component:topic-list",
(Superclass) =>
@discourseComputed( class extends Superclass {
"category", @discourseComputed(
"siteSettings.disable_resorting_on_categories_enabled" "category",
) "siteSettings.disable_resorting_on_categories_enabled"
sortable(category, disable_resorting_on_categories_enabled) { )
let disableSort = false; sortable(category, disable_resorting_on_categories_enabled) {
if ( let disableSort = false;
disable_resorting_on_categories_enabled && if (
category?.custom_fields disable_resorting_on_categories_enabled &&
) { category?.custom_fields
disableSort = !!category.custom_fields["disable_topic_resorting"]; ) {
disableSort =
!!category.custom_fields["disable_topic_resorting"];
}
return !!this.changeSort && !disableSort;
}
} }
return !!this.changeSort && !disableSort; );
},
});
}); });
}, },
}; };