mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
FIX: bufferedValuesString.split is not a function (#8463)
Fix an error `bufferedValuesString.split is not a function`. It is happening when bufferedValue is a positive boolean (checkbox value)
This commit is contained in:
parent
a54aaeeb79
commit
fa52ed3b16
@ -26,6 +26,14 @@ const CUSTOM_TYPES = [
|
|||||||
|
|
||||||
const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"];
|
const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"];
|
||||||
|
|
||||||
|
function splitPipes(str) {
|
||||||
|
if (typeof str === "string") {
|
||||||
|
return str.split("|").filter(Boolean);
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default Mixin.create({
|
export default Mixin.create({
|
||||||
classNameBindings: [":row", ":setting", "overridden", "typeClass"],
|
classNameBindings: [":row", ":setting", "overridden", "typeClass"],
|
||||||
content: alias("setting"),
|
content: alias("setting"),
|
||||||
@ -101,23 +109,16 @@ export default Mixin.create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("buffered.value")
|
@discourseComputed("buffered.value")
|
||||||
bufferedValues(bufferedValuesString) {
|
bufferedValues: splitPipes,
|
||||||
return (
|
|
||||||
bufferedValuesString && bufferedValuesString.split("|").filter(Boolean)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("setting.defaultValues")
|
@discourseComputed("setting.defaultValues")
|
||||||
defaultValues(defaultValuesString) {
|
defaultValues: splitPipes,
|
||||||
return (
|
|
||||||
defaultValuesString && defaultValuesString.split("|").filter(Boolean)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("defaultValues", "bufferedValues")
|
@discourseComputed("defaultValues", "bufferedValues")
|
||||||
defaultIsAvailable(defaultValues, bufferedValues) {
|
defaultIsAvailable(defaultValues, bufferedValues) {
|
||||||
return (
|
return (
|
||||||
defaultValues &&
|
defaultValues &&
|
||||||
|
defaultValues.length > 0 &&
|
||||||
!defaultValues.every(value => bufferedValues.includes(value))
|
!defaultValues.every(value => bufferedValues.includes(value))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user