FIX: wrong links to subcategories in top categories section of user summary

This commit is contained in:
Neil Lalonde 2018-08-02 17:38:32 -04:00
parent c81bad3232
commit 864e279aaf
1 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import { emojiUnescape } from "discourse/lib/text";
import PreloadStore from "preload-store";
import { defaultHomepage } from "discourse/lib/utilities";
import { userPath } from "discourse/lib/url";
import Category from "discourse/models/category";
export const SECOND_FACTOR_METHODS = { TOTP: 1, BACKUP_CODE: 2 };
@ -665,6 +666,14 @@ const User = RestModel.extend({
});
}
if (summary.top_categories) {
summary.top_categories.forEach(c => {
if (c.parent_category_id) {
c.parentCategory = Category.findById(c.parent_category_id);
}
});
}
return summary;
}
);