Make sure emails from RecentChange::save() are for comitted rows

Change-Id: I9086a70348d2f0843527e3805e9f6aef3356ee03
This commit is contained in:
Aaron Schulz 2016-09-12 14:23:14 -07:00
parent 0f05bb3a01
commit 047b90e744

View file

@ -336,9 +336,13 @@ class RecentChange {
$title = $this->getTitle();
// Never send an RC notification email about categorization changes
if ( $this->mAttribs['rc_type'] != RC_CATEGORIZE ) {
if ( Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] ) ) {
# @todo FIXME: This would be better as an extension hook
if (
$this->mAttribs['rc_type'] != RC_CATEGORIZE &&
Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] )
) {
// @FIXME: This would be better as an extension hook
// Send emails or email jobs once this row is safely committed
$dbw->onTransactionIdle( function () use ( $editor, $title ) {
$enotif = new EmailNotification();
$enotif->notifyOnPageChange(
$editor,
@ -349,7 +353,7 @@ class RecentChange {
$this->mAttribs['rc_last_oldid'],
$this->mExtra['pageStatus']
);
}
} );
}
}