mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 09:07:49 +08:00
The parent component of `ThemeSettingRelativesSelectorComponent`, `SiteSettingComponent`, has recently been migrated from being a legacy component to a Glimmer component (in https://github.com/discourse/discourse/pull/33255), but we missed updating the child class to use Glimmer's patterns, namely how arguments are accessed in Glimmer components (`this.args.foo` vs `this.foo`).
24 lines
600 B
JavaScript
Vendored
24 lines
600 B
JavaScript
Vendored
import SiteSettingComponent from "./site-setting";
|
|
|
|
export default class ThemeSettingRelativesSelectorComponent extends SiteSettingComponent {
|
|
_save() {
|
|
return this.args.model.save({
|
|
[this.args.setting.setting]: this.convertNamesToIds(),
|
|
});
|
|
}
|
|
|
|
convertNamesToIds() {
|
|
return this.buffered
|
|
.get("value")
|
|
.split("|")
|
|
.filter(Boolean)
|
|
.map((themeName) => {
|
|
if (themeName !== "") {
|
|
return this.args.setting.allThemes.find(
|
|
(theme) => theme.name === themeName
|
|
).id;
|
|
}
|
|
return themeName;
|
|
});
|
|
}
|
|
}
|