mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 13:13:40 +08:00
8d4f405da4
Why this change? On the `/admin/customize/themes/<:id>` route, we allow admins to edit all settings via a settings editor. Prior to this change, trying to edit and save a typed objects theme settings will result in an error on the server.
20 lines
490 B
JavaScript
20 lines
490 B
JavaScript
import EmberObject from "@ember/object";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
import Setting from "admin/mixins/setting-object";
|
|
|
|
export default class ThemeSettings extends EmberObject.extend(Setting) {
|
|
updateSetting(themeId, newValue) {
|
|
if (this.objects_schema) {
|
|
newValue = JSON.stringify(newValue);
|
|
}
|
|
|
|
return ajax(`/admin/themes/${themeId}/setting`, {
|
|
type: "PUT",
|
|
data: {
|
|
name: this.setting,
|
|
value: newValue,
|
|
},
|
|
});
|
|
}
|
|
}
|