Page MenuHomePhabricator

Migrate "emailuser" Notification to Core
Open, Needs TriagePublic

Description

Core provides a EmailUserComplete that is used only by Echo to trigger the notification about user getting an email.

By making MediaWiki core trigger the notification about email being sent, we could deprecate the hook and also provide flexibility for extensions to modify the notification being sent.

Event Timeline

Change #1143615 had a related patch set uploaded (by Pmiazga; author: Pmiazga):

[mediawiki/core@master] WIP: handle emailuser notification

https://gerrit.wikimedia.org/r/1143615

Change #1143616 had a related patch set uploaded (by Pmiazga; author: Pmiazga):

[mediawiki/extensions/Echo@master] WIP: Core triggers the email notification

https://gerrit.wikimedia.org/r/1143616

@matmarex @Mooeypoo I wonder if the new Notification should be compatible with the hook we want to deprecate. The hook interface was :

https://www.mediawiki.org/wiki/Manual:Hooks/EmailUserComplete -> it was getting both $subject and the $text.

In the notification I'm only including preview which is the required thing that will be presented. Altough I wonder if we should add at least $subject in case someone wants do something with that notification via Middleware. This is possible by passing $subject to the custom array.

On the other hand, it wont be used, if there is a need someone can easily modify the

$this->notificationService->notify(
	new MailNotification( $from, $preview ),
	new RecipientSet( [ $to ] ),
);

and pass the extra array as a last param:

$this->notificationService->notify(
	new MailNotification( $from, $preview, $extra ),
	new RecipientSet( [ $to ] ),
);

I wonder if the new Notification should be compatible with the hook we want to deprecate.

Very much no. I don't want us to add a third general-purpose hook system. This is supposed to be just a notification.

Moving to blocked. There is a patch for this change, but it requires improvement. As it's not a priority for now, let me put this in "waiting" list.