Legoktm has uploaded a new change for review.

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

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

Fix sending when $wgEmailConfirmToEdit is true

Bug: 73061
Change-Id: I410c5a760248a5b38bb90ac1052930017e18631d
---
M MassMessage.hooks.php
M includes/job/MassMessageJob.php
2 files changed, 16 insertions(+), 1 deletion(-)


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

diff --git a/MassMessage.hooks.php b/MassMessage.hooks.php
index 1c18e5e..ad02f41 100644
--- a/MassMessage.hooks.php
+++ b/MassMessage.hooks.php
@@ -226,4 +226,18 @@
                }
                return true;
        }
+
+       /**
+        * Mark the messenger account's email as confirmed in job runs (bug 
73061)
+        * @param User $user
+        * @param bool &$confirmed
+        * @return bool
+        */
+       public static function onEmailConfirmed( User $user, &$confirmed ) {
+               if ( $user->getId() === 
MassMessage::getMessengerUser()->getId() ) {
+                       $confirmed = true;
+                       return false; // Skip further checks
+               }
+               return true;
+       }
 }
diff --git a/includes/job/MassMessageJob.php b/includes/job/MassMessageJob.php
index 7d54ed6..4c6e1ba 100644
--- a/includes/job/MassMessageJob.php
+++ b/includes/job/MassMessageJob.php
@@ -202,9 +202,10 @@
        function makeAPIRequest( array $params ) {
                global $wgHooks, $wgUser, $wgRequest;
 
-               // Add our hook function to make the MassMessage user IP 
block-exempt
+               // Add our hook functions to make the MassMessage user IP 
block-exempt and email confirmed
                // Done here so that it's not unnecessarily called on every 
page load
                $wgHooks['UserGetRights'][] = 
'MassMessageHooks::onUserGetRights';
+               $wgHooks['EmailConfirmed'][] = 
'MassMessageHooks::onEmailConfirmed';
 
                $oldRequest = $wgRequest;
                $oldUser = $wgUser;

-- 
To view, visit https://gerrit.wikimedia.org/r/171594
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: REL1_24
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Wctaiwan <wctai...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to