Fix: new items may not have type on creation
Dieser Commit ist enthalten in:
Ursprung
de8b4f9b2e
Commit
b74a46a89f
1 geänderte Dateien mit 10 neuen und 7 gelöschten Zeilen
|
@ -197,7 +197,6 @@ if (Discourse.SiteSettings.wizard_apis_enabled) {
|
||||||
export function setWizardDefaults(obj, itemType, opts={}) {
|
export function setWizardDefaults(obj, itemType, opts={}) {
|
||||||
const objSchema = wizardSchema[itemType];
|
const objSchema = wizardSchema[itemType];
|
||||||
const basicDefaults = objSchema.basic;
|
const basicDefaults = objSchema.basic;
|
||||||
const typeDefaults = objSchema.types[obj.type];
|
|
||||||
|
|
||||||
Object.keys(basicDefaults).forEach(property => {
|
Object.keys(basicDefaults).forEach(property => {
|
||||||
let defaultValue = get(basicDefaults, property);
|
let defaultValue = get(basicDefaults, property);
|
||||||
|
@ -206,12 +205,16 @@ export function setWizardDefaults(obj, itemType, opts={}) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeDefaults) {
|
if (objSchema.types) {
|
||||||
Object.keys(typeDefaults).forEach(property => {
|
const typeDefaults = objSchema.types[obj.type];
|
||||||
if (typeDefaults.hasOwnProperty(property)) {
|
|
||||||
set(obj, property, get(typeDefaults, property));
|
if (typeDefaults) {
|
||||||
}
|
Object.keys(typeDefaults).forEach(property => {
|
||||||
});
|
if (typeDefaults.hasOwnProperty(property)) {
|
||||||
|
set(obj, property, get(typeDefaults, property));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
Laden …
In neuem Issue referenzieren