Skip to content

Enhance rollback event listeners to include target revision for mutat… - #28

Merged
thijskok merged 2 commits into
mainfrom
add-revision-context-to-rollback-events
Jul 22, 2026
Merged

Enhance rollback event listeners to include target revision for mutat…#28
thijskok merged 2 commits into
mainfrom
add-revision-context-to-rollback-events

Conversation

@thijskok

Copy link
Copy Markdown
Contributor

…ion and verification

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enhances the rollback event system in HasRevisions so rollback listeners can receive (and optionally mutate) the specific target revision being rolled back to, with accompanying tests to validate the new behavior.

Changes:

  • Adds tests to ensure rollingBack/rolledBack listeners receive the target Revision and can mutate it before restore.
  • Updates rollback event dispatching to pass the target revision through a new fireRevisionEvent() helper and refreshes event docblocks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/RevisionEventsTest.php Adds/adjusts test coverage for passing the target revision to rollback listeners and allowing mutation before restore.
src/Concerns/HasRevisions.php Dispatches rollback events with both model + target revision via fireRevisionEvent() and updates event documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 283 to 286
public function rollbackToRevision(RevisionContract $revision): bool
{
if ($this->fireModelEvent('rollingBack') === false) {
if ($this->fireRevisionEvent('rollingBack', true, $revision) === false) {
return false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nopes, not relevant yet.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Concerns/HasRevisions.php 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thijskok
thijskok requested a review from Frankisgek July 21, 2026 21:48
@thijskok
thijskok merged commit fa710ac into main Jul 22, 2026
8 checks passed
@thijskok
thijskok deleted the add-revision-context-to-rollback-events branch July 22, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants