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