Wctaiwan has uploaded a new change for review.

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

Change subject: Fix sending when $wgEmailConfirmToEdit is true
......................................................................

Fix sending when $wgEmailConfirmToEdit is true

Bug: 73061
Change-Id: I410c5a760248a5b38bb90ac1052930017e18631d
---
M MassMessage.hooks.php
M MassMessage.php
2 files changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage 
refs/changes/83/171483/1

diff --git a/MassMessage.hooks.php b/MassMessage.hooks.php
index c81ab21..0389ec8 100644
--- a/MassMessage.hooks.php
+++ b/MassMessage.hooks.php
@@ -239,4 +239,21 @@
                }
                return true;
        }
+
+       /**
+        * Mark the messenger account's email as confirmed if needed (bug 73061)
+        * @param User $user
+        * @param bool &$confirmed
+        * @return bool
+        */
+       public static function onEmailConfirmed( $user, &$confirmed ) {
+               global $wgEmailConfirmToEdit;
+               if ( $wgEmailConfirmToEdit
+                       && $user->getId() === 
MassMessage::getMessengerUser()->getId()
+               ) {
+                       $confirmed = true;
+                       return false; // Skip further checks
+               }
+               return true;
+       }
 }
diff --git a/MassMessage.php b/MassMessage.php
index c22bdb7..959e402 100644
--- a/MassMessage.php
+++ b/MassMessage.php
@@ -109,6 +109,7 @@
 $wgHooks['BeforeEchoEventInsert'][] = 
'MassMessageHooks::onBeforeEchoEventInsert';
 $wgHooks['SkinTemplateNavigation'][] = 
'MassMessageHooks::onSkinTemplateNavigation';
 $wgHooks['BeforePageDisplay'][] = 'MassMessageHooks::onBeforePageDisplay';
+$wgHooks['EmailConfirmed'][] = 'MassMessageHooks::onEmailConfirmed';
 
 // Special pages
 $wgSpecialPages['MassMessage'] = 'SpecialMassMessage';

-- 
To view, visit https://gerrit.wikimedia.org/r/171483
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I410c5a760248a5b38bb90ac1052930017e18631d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Wctaiwan <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to