Skip to content

chore(trashbin): deprecate abortOperation on BeforeNodeRestoredEvent / switch to AbortedEventException#59043

Merged
susnux merged 6 commits intomasterfrom
jtr/chore-trashbin-drop-abortOperation-usage
Mar 25, 2026
Merged

chore(trashbin): deprecate abortOperation on BeforeNodeRestoredEvent / switch to AbortedEventException#59043
susnux merged 6 commits intomasterfrom
jtr/chore-trashbin-drop-abortOperation-usage

Conversation

@joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Mar 18, 2026

  • Resolves: #

Summary

Deprecates BeforeNodeRestoredEvent::abortOperation() to match the deprecation already applied to BeforeNodeDeletedEvent::abortOperation() and BeforeNodeRenamedEvent::abortOperation() in Nextcloud 29. BeforeNodeRestoredEvent was missed in that round.

Changes:

  • Switched all three $event->abortOperation() call sites in files_trashbin's SyncLivePhotosListener::handleRestore() to throw AbortedEventException directly.
  • Adjusted BeforeNodeRestoredEvent::abortOperation() to throw AbortedEventException internally (matching the files app's BeforeNodeDeletedEvent::abortOperation()), and marked it @deprecated.
  • Added try/catch for AbortedEventException at the Trashbin::restore() dispatch site, consistent with how HookConnector::delete() handles it for the files app.

Fixes a bug: In the existing implementation, Trashbin::restore()'s if (!$run) check is dead code -- abortOperation() sets $run = false but immediately throws, so the exception unwinds past the check. The operation is aborted only because an uncaught exception propagates up the stack as an HTTP 500, not via the intended graceful return false path. This PR makes the abort mechanism work as designed + match its counterparts in the files app.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Mar 18, 2026
@joshtrichards

This comment has been minimized.

@joshtrichards joshtrichards added feature: trashbin bug ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) 3. to review Waiting for reviews labels Mar 18, 2026
@joshtrichards joshtrichards marked this pull request as ready for review March 18, 2026 14:21
@joshtrichards joshtrichards requested a review from a team as a code owner March 18, 2026 14:21
@joshtrichards joshtrichards requested review from CarlSchwan, artonge, icewind1991, leftybournes and salmart-dev and removed request for a team March 18, 2026 14:21
…ntException

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards force-pushed the jtr/chore-trashbin-drop-abortOperation-usage branch from f55dffd to 8bd63c5 Compare March 21, 2026 15:50
@susnux susnux merged commit 2ae66ff into master Mar 25, 2026
204 of 206 checks passed
@susnux susnux deleted the jtr/chore-trashbin-drop-abortOperation-usage branch March 25, 2026 17:15
@backportbot

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews backport-request bug feature: trashbin ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants