mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 14:35:58 +08:00
74349e17c9
This commit was generated using the ember-native-class-codemod along with a handful of manual updates
26 lines
648 B
JavaScript
26 lines
648 B
JavaScript
import RestAdapter from "discourse/adapters/rest";
|
|
|
|
export default class Theme extends RestAdapter {
|
|
jsonMode = true;
|
|
basePath() {
|
|
return "/admin/";
|
|
}
|
|
|
|
afterFindAll(results) {
|
|
let map = {};
|
|
results.forEach((theme) => {
|
|
map[theme.id] = theme;
|
|
});
|
|
results.forEach((theme) => {
|
|
let mapped = theme.get("child_themes") || [];
|
|
mapped = mapped.map((t) => map[t.id]);
|
|
theme.set("childThemes", mapped);
|
|
|
|
let mappedParents = theme.get("parent_themes") || [];
|
|
mappedParents = mappedParents.map((t) => map[t.id]);
|
|
theme.set("parentThemes", mappedParents);
|
|
});
|
|
return results;
|
|
}
|
|
}
|