jenkins-bot has submitted this change and it was merged.

Change subject: Use LocalUserCreated hook instead of AddNewAccount
......................................................................


Use LocalUserCreated hook instead of AddNewAccount

Since the extension is using short array syntax, I'm going to guess
there's no need to complicate it by worrying about compatibility with
MediaWiki core < 1.26.

Bug: T135065
Change-Id: I81dd764940ebb400f3ecdf15934f6f501c05ea9c
(cherry picked from commit 918b74ea9efb069c398a5a18bffb6106de7f52e9)
---
M Thanks.hooks.php
M extension.json
2 files changed, 9 insertions(+), 7 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index 4b77787..45d8755 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -235,17 +235,19 @@
        }
 
        /**
-        * Handler for AddNewAccount hook
-        * @see http://www.mediawiki.org/wiki/Manual:Hooks/AddNewAccount
+        * Handler for LocalUserCreated hook
+        * @see http://www.mediawiki.org/wiki/Manual:Hooks/LocalUserCreated
         * @param $user User object that was created.
-        * @param $byEmail bool True when account was created "by email".
+        * @param $autocreated bool True when account was auto-created
         * @return bool
         */
-       public static function onAccountCreated( $user, $byEmail ) {
+       public static function onAccountCreated( $user, $autocreated ) {
                // New users get echo preferences set that are not the default 
settings for existing users.
                // Specifically, new users are opted into email notifications 
for thanks.
-               $user->setOption( 'echo-subscriptions-email-edit-thank', true );
-               $user->saveSettings();
+               if ( !$autocreated ) {
+                       $user->setOption( 
'echo-subscriptions-email-edit-thank', true );
+                       $user->saveSettings();
+               }
                return true;
        }
 
diff --git a/extension.json b/extension.json
index ebfbe07..d56605b 100644
--- a/extension.json
+++ b/extension.json
@@ -152,7 +152,7 @@
                "EchoGetDefaultNotifiedUsers": [
                        "ThanksHooks::onEchoGetDefaultNotifiedUsers"
                ],
-               "AddNewAccount": [
+               "LocalUserCreated": [
                        "ThanksHooks::onAccountCreated"
                ],
                "BeforeSpecialMobileDiffDisplay": [

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I81dd764940ebb400f3ecdf15934f6f501c05ea9c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: REL1_27
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to