Skip to content

Refactor notification summary handling to use Summary value object - #2

Merged
thijskok merged 3 commits into
mainfrom
added-summary-return-object
Jul 28, 2026
Merged

Refactor notification summary handling to use Summary value object#2
thijskok merged 3 commits into
mainfrom
added-summary-return-object

Conversation

@thijskok

Copy link
Copy Markdown
Contributor

No description provided.

@thijskok
thijskok force-pushed the added-summary-return-object branch from a136044 to 75862c6 Compare July 27, 2026 19:25
@codecov-commenter

codecov-commenter commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors the notification summary payload from a loose array shape to a dedicated Summary value object, updating the public toSummary() contract and adapting mail/database rendering accordingly.

Changes:

  • Introduces TestMonitor\Floodgate\Notifications\Summary (fluent builder + toArray() for database channel payloads).
  • Updates toSummary() signatures (contract + trait + test notification) to return Summary, and updates SummaryNotification to delegate array conversion and mail subject selection to it.
  • Updates the summary mail Blade view + README + tests to use the new object model and add coverage for optional title/subject/action behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/SummaryTest.php Adds unit coverage for Summary::with() and Summary::toArray() behavior.
tests/SummaryNotificationTest.php Updates existing summary tests to use Summary and adds mail rendering tests for title/subject/action.
tests/Notifications/TestNotification.php Updates toSummary() to return a Summary instance.
tests/FlushingNotificationsTest.php Updates expected database payload key from properties to data.
src/Notifications/SummaryNotification.php Accepts a Summary object and delegates array conversion + mail subject selection to it.
src/Notifications/Summary.php New value object encapsulating summary fields and array serialization.
src/Contracts/Gated.php Changes toSummary() contract return type to Summary.
src/Concerns/Gateable.php Changes abstract toSummary() return type to Summary.
resources/views/summary.blade.php Renders the Summary object (title/message/data + optional action button).
README.md Updates documentation/examples for the new Summary API and customization guidance.

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

# {{ __($summary->title, $summary->data) }}
@endif

{{ __($summary->message, $summary->data) }}

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.

Ehm... no...

Comment on lines +16 to +18
@if ($summary->actionText)
@component('mail::button', ['url' => $summary->actionUrl])
@lang($summary->actionText)

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.

Mimicking Laravel :)

@thijskok
thijskok requested review from Frankisgek and stefanius July 27, 2026 19:42
@thijskok
thijskok merged commit 2bbc14e into main Jul 28, 2026
7 checks passed
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.

5 participants