DEV: Fix settings/interface UI breaking on Ember CLI (#12154)

Fixes failures in user-preferences-interface-test on Ember CLI.

Included:
* DEV: User themes have `theme_id` not `id`
* FIX: `themeId` could point to a non-existent theme
* DEV: Add request stub

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
This commit is contained in:
Jarek Radosz 2021-02-24 16:14:06 +01:00 committed by GitHub
parent b7b81afe55
commit daf34ae7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -157,9 +157,12 @@ export default Controller.extend({
return false;
}
const currentThemeColorSchemeId = userThemes.findBy("id", themeId)
.color_scheme_id;
return userColorSchemes.findBy("id", currentThemeColorSchemeId);
const theme = userThemes.findBy("id", themeId);
if (!theme) {
return false;
}
return userColorSchemes.findBy("id", theme.color_scheme_id);
},
showColorSchemeNoneItem: not("currentSchemeCanBeSelected"),

View File

@ -79,7 +79,7 @@ acceptance("User Preferences - Interface", function (needs) {
test("shows light color scheme default option when theme's color scheme is not user selectable", async function (assert) {
let site = Site.current();
site.set("user_themes", [
{ id: 1, name: "Cool Theme", color_scheme_id: null },
{ theme_id: 1, name: "Cool Theme", color_scheme_id: null },
]);
site.set("user_color_schemes", [{ id: 2, name: "Cool Breeze" }]);

View File

@ -792,6 +792,13 @@ export function applyDefaultHandlers(pretender) {
});
});
pretender.get("/color-scheme-stylesheet/2/1.json", () => {
return response(200, {
color_scheme_id: 2,
new_href: "/stylesheets/color_definitions_scheme_name_2_hash.css",
});
});
pretender.get("/inline-onebox", (request) => {
if (
request.queryParams.urls.includes("http://www.example.com/has-title.html")