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
58e9e081bd373a3ff846da81159767d60c387e8f
1 file changed
+3
-3
admin/src/FileForm.ts
+3
-3
@@ -246,7 +246,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
246
hideValues, isChildren, isDir, contentText="folder content", setApi, ...rest }: WhoFieldProps): ReactElement {
247
const defaultLabel = who2desc(byMasks ?? inherit)
248
+ prefix(' (', byMasks !== undefined ? "from masks" : parent !== undefined ? "inherited" : "default", ')')
249
- const objectMode = isWhoObject(value)
249
+ const objectMode = isWhoObject(value)
250
const thisValue = objectMode ? value.this : value
251
252
const options = useMemo(() =>
@@ -259,7 +259,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
259
{ value: [], label: "Select accounts" },
260
].map(x => !hideValues?.includes(x.value)
261
&& { label: who2desc(x.value), ...x })), // default label
262
- [inherit, parent, thisValue])
262
+ [inherit, parent, thisValue, ...wantArray(hideValues)])
263
264
const timeout = 500
265
const arrayMode = Array.isArray(thisValue)
@@ -293,7 +293,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
293
h(WhoField, {
294
label: "Permission for " + contentText,
295
parent, inherit, accounts, otherPerms, isDir,
296
- value: objectMode && value?.children,
296
+ value: objectMode ? value?.children : undefined,
297
isChildren: true,
298
hideValues: [thisValue ?? inherit, thisValue],
299
onChange(v, { event }) {