fix: admin/fs: in case a permission of a folder is in different-permissions mode, changing the main value didn't update the possible values for the content until it was saved
Massimo Melina committed
Oct 12, 2024 at 11:32 UTC
cd6cf1b82fef894c91faaf902d5a26e8411a5a3c
1 file changed
+3
-3
admin/src/FileForm.ts
+3
-3
@@ -222,7 +222,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
222
hideValues, isChildren, isDir, contentText="folder content", setApi, ...rest }: WhoFieldProps): ReactElement {
223
const defaultLabel = who2desc(byMasks ?? inherit)
224
+ prefix(' (', byMasks !== undefined ? "from masks" : parent !== undefined ? "inherited" : "default", ')')
225
- const objectMode = isWhoObject(value)
225
+ const objectMode = isWhoObject(value)
226
const thisValue = objectMode ? value.this : value
227
228
const options = useMemo(() =>
@@ -235,7 +235,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
235
{ value: [], label: "Select accounts" },
236
].map(x => !hideValues?.includes(x.value)
237
&& { label: who2desc(x.value), ...x })), // default label
238
- [inherit, parent, thisValue])
238
+ [inherit, parent, thisValue, ...wantArray(hideValues)])
239
240
const timeout = 500
241
const arrayMode = Array.isArray(thisValue)
@@ -269,7 +269,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
269
h(WhoField, {
270
label: "Permission for " + contentText,
271
parent, inherit, accounts, otherPerms, isDir,
272
- value: objectMode && value?.children,
272
+ value: objectMode ? value?.children : undefined,
273
isChildren: true,
274
hideValues: [thisValue ?? inherit, thisValue],
275
onChange(v, { event }) {