mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
fix: 'Empty trash' button should be hidden with no permissions (#10704)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user