2022-03-07 00:19:21 +01:00
|
|
|
import { computed, get } from "@ember/object";
|
2024-01-16 17:50:43 +01:00
|
|
|
import Category from "discourse/models/category";
|
2015-09-17 12:21:41 -04:00
|
|
|
|
|
|
|
export default {
|
2018-10-22 19:49:33 +01:00
|
|
|
name: "extend-category-for-solved",
|
2019-10-02 07:36:35 +02:00
|
|
|
|
2018-10-22 19:49:33 +01:00
|
|
|
before: "inject-discourse-objects",
|
2019-10-02 07:36:35 +02:00
|
|
|
|
2015-09-17 12:21:41 -04:00
|
|
|
initialize() {
|
|
|
|
Category.reopen({
|
2022-03-06 21:33:24 +01:00
|
|
|
enable_accepted_answers: computed(
|
2019-10-02 07:36:35 +02:00
|
|
|
"custom_fields.enable_accepted_answers",
|
|
|
|
{
|
2019-10-23 15:37:37 +02:00
|
|
|
get(fieldName) {
|
2022-03-07 00:19:21 +01:00
|
|
|
return get(this.custom_fields, fieldName) === "true";
|
2020-09-04 13:22:22 +02:00
|
|
|
},
|
2015-09-17 12:21:41 -04:00
|
|
|
}
|
2020-09-04 13:22:22 +02:00
|
|
|
),
|
2015-09-17 12:21:41 -04:00
|
|
|
});
|
2020-09-04 13:22:22 +02:00
|
|
|
},
|
2015-09-17 12:21:41 -04:00
|
|
|
};
|