fix: 'Empty trash' button should be hidden with no permissions (#10704)

This commit is contained in:
Tom Moor
2025-11-23 21:00:28 +01:00
committed by GitHub
parent 9925c692c1
commit 82021b685e
2 changed files with 11 additions and 7 deletions
+6 -6
View File
@@ -30,20 +30,20 @@ const ActionButton = React.forwardRef<HTMLButtonElement, Props>(
});
const isMounted = useIsMounted();
const [executing, setExecuting] = React.useState(false);
const disabled = rest.disabled;
if (!actionContext || !action) {
return <button {...rest} ref={ref} />;
}
if (
action.visible &&
!resolve<boolean>(action.visible, actionContext) &&
hideOnActionDisabled
) {
const actionIsDisabled =
action.visible && !resolve<boolean>(action.visible, actionContext);
if (actionIsDisabled && hideOnActionDisabled) {
return null;
}
const disabled = rest.disabled || actionIsDisabled;
const label =
rest["aria-label"] ??
(typeof action.name === "function"
+5 -1
View File
@@ -20,7 +20,11 @@ function Trash() {
title={t("Trash")}
actions={
documents.deleted.length > 0 && (
<Button neutral action={permanentlyDeleteDocumentsInTrash}>
<Button
neutral
action={permanentlyDeleteDocumentsInTrash}
hideOnActionDisabled
>
{t("Empty trash")}
</Button>
)