discourse/app/assets/javascripts/admin/addon/components/theme-setting-relatives-selector.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
621 B
JavaScript
Raw Normal View History

import SiteSettingComponent from "./site-setting";
export default class ThemeSettingRelativesSelectorComponent extends SiteSettingComponent {
_save() {
return this.model
.save({ [this.setting.setting]: this.convertNamesToIds() })
.then(() => this.store.findAll("theme"));
}
convertNamesToIds() {
return this.get("buffered.value")
.split("|")
.filter(Boolean)
.map((themeName) => {
if (themeName !== "") {
return this.setting.allThemes.find(
(theme) => theme.name === themeName
).id;
}
return themeName;
});
}
}