FIX: Load the category when the category_id attr is present. (#13621)
The store won't autoload the reviewable category anymore as we removed that piece of code in #13412. This commit adds it as a computed property.
This commit is contained in:
parent
02999f5eb2
commit
7e6a317597
|
@ -11,7 +11,7 @@ export const REJECTED = 2;
|
|||
export const IGNORED = 3;
|
||||
export const DELETED = 4;
|
||||
|
||||
export default RestModel.extend({
|
||||
const Reviewable = RestModel.extend({
|
||||
@discourseComputed("type", "topic")
|
||||
humanType(type, topic) {
|
||||
// Display "Queued Topic" if the post will create a topic
|
||||
|
@ -24,6 +24,11 @@ export default RestModel.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@discourseComputed("category_id")
|
||||
category(categoryId) {
|
||||
return Category.findById(categoryId);
|
||||
},
|
||||
|
||||
update(updates) {
|
||||
// If no changes, do nothing
|
||||
if (Object.keys(updates).length === 0) {
|
||||
|
@ -50,3 +55,13 @@ export default RestModel.extend({
|
|||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reviewable.reopenClass({
|
||||
munge(json) {
|
||||
// ensure we are not overriding category computed property
|
||||
delete json.category;
|
||||
return json;
|
||||
},
|
||||
});
|
||||
|
||||
export default Reviewable;
|
||||
|
|
Loading…
Reference in New Issue