DEV: Update modifyClass calls to native class syntax (#656)
This commit is contained in:
parent
6f682acae3
commit
b8d50e9675
|
|
@ -5,24 +5,27 @@ export default {
|
|||
name: "disable-sort",
|
||||
initialize() {
|
||||
withPluginApi("0.8", (api) => {
|
||||
api.modifyClass("component:topic-list", {
|
||||
pluginId: "discourse-calendar",
|
||||
|
||||
@discourseComputed(
|
||||
"category",
|
||||
"siteSettings.disable_resorting_on_categories_enabled"
|
||||
)
|
||||
sortable(category, disable_resorting_on_categories_enabled) {
|
||||
let disableSort = false;
|
||||
if (
|
||||
disable_resorting_on_categories_enabled &&
|
||||
category?.custom_fields
|
||||
) {
|
||||
disableSort = !!category.custom_fields["disable_topic_resorting"];
|
||||
api.modifyClass(
|
||||
"component:topic-list",
|
||||
(Superclass) =>
|
||||
class extends Superclass {
|
||||
@discourseComputed(
|
||||
"category",
|
||||
"siteSettings.disable_resorting_on_categories_enabled"
|
||||
)
|
||||
sortable(category, disable_resorting_on_categories_enabled) {
|
||||
let disableSort = false;
|
||||
if (
|
||||
disable_resorting_on_categories_enabled &&
|
||||
category?.custom_fields
|
||||
) {
|
||||
disableSort =
|
||||
!!category.custom_fields["disable_topic_resorting"];
|
||||
}
|
||||
return !!this.changeSort && !disableSort;
|
||||
}
|
||||
}
|
||||
return !!this.changeSort && !disableSort;
|
||||
},
|
||||
});
|
||||
);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue