Repository navigation
feat(actions): optional confirmation before Direct Delete - #163
Conversation
b8e7cb9 to
c467bfb
Compare
Direct Delete bypasses the Trash, so add a second confirmation, on by default, with a toggle nested under Direct Delete in Settings → Actions. Run folder authorization before that confirmation: previously the flow was "confirm → authorize per item → delete", so cancelling an authorization panel after confirming silently skipped items while the alert had claimed a larger count. Authorization also re-checks hasAccess afterwards, because a non-nil prompt result does not guarantee access (bookmark creation may fail, or the user may pick another folder). Extract DeleteConfirmationProviding / AlertDeleteConfirmation and inject it into ActionService, the same way PermissionProviding is injected, so confirm, cancel and the ordering are unit-tested instead of only reachable through NSAlert. Known trade-off: cancelling the confirmation leaves the folder grant in place, since authorization now happens first.
c467bfb to
7d3ac29
Compare
6c4c9bf to
214315f
Compare
|
Thanks for the PR. After reviewing it, I feel the additional setting you added on top of the existing “Direct Delete” setting doesn’t fit well with the other settings. A cleaner approach, in my view, would be to use the Option key:
This keeps the safe default confirmation while still letting power users bypass it for a single action, without adding a new setting that feels inconsistent with the existing ones. What do you think — would you be open to adjusting the PR in this direction? |
同意。设置里的常驻开关拿掉,确认保持默认开启。要跳过的话按住 Option,只对这一次生效。 为了让这个操作找得到,放在两处:
这样日常删除还有确认。知道这个键的人不用进设置改默认值,菜单标题的变化本身就是提示。 如果这个方案可以,我就按此改。 |


Summary
Adds an optional second confirmation before Direct Delete (bypasses Trash) — on by default, nested under Direct Delete in Settings → Actions.
Also fixes delete ordering: authorize first, then confirm as the last gate, so the alert matches what will actually be removed. Re-checks
hasAccessafter the permission prompt (a non-nilresult can still mean a failed bookmark or a different folder). InjectsDeleteConfirmationProvidingfor unit tests (confirm / cancel / ordering / authorized subset).Type of Change
Related Issue
Related to #81
Screenshots
Testing
Manual Testing
Build Verification
Local:
ActionServiceTests9/9 passed. CI runsRClickTestson this PR.Checklist
NSAlert)CHANGELOG)devAdditional Notes
关于 建议【直接删除】功能还是增加个二次确认吧 #81
这个确认是可选的。关掉之后和以前没有任何区别,直接删除还是一步完成;开着是给需要防止误删的人多一道确认。默认开着,开关在「设置 → 操作 → 直接删除」下面的「删除时二次确认」。本改动将「删除时二次确认」设为默认开启。若维护者认为默认关闭更为合适,请告知,我会据此调整默认值。
Cancel after grant keeps the bookmark (Settings → Folder Permissions). Auth-before-confirm is intentional so confirmed deletes are not silently half-skipped.
NSAlert— same pattern as existing delete/AirDrop alerts in this target; not a new AppKit surface.