Skip to content

IBX-12339: Log a warning when notifier subscription is missing - #2036

Open
vidarl wants to merge 3 commits into
5.0from
IBX-12339_notifier_does_not_log_when_unconfigured
Open

vidarl wants to merge 3 commits into
5.0from
IBX-12339_notifier_does_not_log_when_unconfigured

Conversation

@vidarl

@vidarl vidarl commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Caution

🎫 Issue IBX-12339

Related PRs:

Strictly speaking not related, but needed in order to make the invite user functionality work end-to-end (IBX-12340):

Description:

Ibexa\AdminUi\Notifier\UserInvitation::sendInvitation() and
Ibexa\AdminUi\Notifier\PasswordReset::sendMessage() both return without sending and without any
trace when notifications.subscriptions does not carry their notification class:

if ($this->isNotifierConfigured()) {
    $this->sendNotification($invitation);
}

Both classes are LoggerAware and are handed a logger, but nothing is logged if the notification
class is not mentioned in notifications.subscriptions.

This PR turns the silent return into a logged warning, naming the exact configuration key to add.

For QA:

  1. Remove Ibexa\AdminUi\Notifier\Notification\UserInvitation from
    ibexa.system.<scope>.notifier.subscriptions, clear cache, and invite a user from the back
    office. The invitation row is still written to ibexa_user_invitation; expect no mail, and in
    var/log/dev.log:
    app.WARNING: No invitation e-mail was sent: subscribe Ibexa\AdminUi\Notifier\Notification\UserInvitation under "ibexa.system.<scope>.notifier.subscriptions" to enable it.
  2. Add the subscription back, clear cache, invite again: mail is sent and nothing is logged.
  3. Same two steps for password reset via Forgot password and
    Ibexa\AdminUi\Notifier\Notification\UserPasswordReset.

Documentation:

@sonarqubecloud

Copy link
Copy Markdown

@mikadamczyk mikadamczyk 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.

PasswordResetTest and UserInvitationTest share an almost identical structure. Could we extract the shared mock wiring into a base test class to avoid maintaining the same pattern twice?

LoggerInterface $logger
): PasswordReset {
$configResolver = $this->createMock(ConfigResolverInterface::class);
$configResolver

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.

$configResolver->method('getParameter') has no ->expects(). Could we add ->expects(self::once()) or atLeastOnce()

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.

Fixed in a6d7ea7

LoggerInterface $logger
): UserInvitation {
$configResolver = $this->createMock(ConfigResolverInterface::class);
$configResolver

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.

$configResolver->method('getParameter') has no ->expects()

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.

@mikadamczyk : Fixed in a6d7ea7

@juskora
juskora force-pushed the IBX-12339_notifier_does_not_log_when_unconfigured branch from be4f62b to 0880aaa Compare October 9, 2026 09:24
@sonarqubecloud

Copy link
Copy Markdown

@vidarl
vidarl requested a review from mikadamczyk October 12, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants