Kaldari has uploaded a new change for review.
https://gerrit.wikimedia.org/r/61152
Change subject: Moving a pref override from Echo to Thanks
......................................................................
Moving a pref override from Echo to Thanks
Bug: 47757
Change-Id: I1aa81cf81ca71af323f0d5448fb5800086a09b1e
---
M Thanks.hooks.php
M Thanks.php
2 files changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks
refs/changes/52/61152/1
diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index 1c280c8..08239d7 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -139,4 +139,19 @@
}
return true;
}
+
+ /**
+ * Handler for AddNewAccount hook
+ * @see http://www.mediawiki.org/wiki/Manual:Hooks/AddNewAccount
+ * @param $user User object that was created.
+ * @param $byEmail bool True when account was created "by email".
+ * @return bool
+ */
+ public static function onAccountCreated( $user, $byEmail ) {
+ // 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();
+ return true;
+ }
}
diff --git a/Thanks.php b/Thanks.php
index ab3d7a0..fab30d5 100644
--- a/Thanks.php
+++ b/Thanks.php
@@ -57,6 +57,7 @@
$wgHooks['DiffViewHeader'][] = 'ThanksHooks::onDiffViewHeader';
$wgHooks['BeforeCreateEchoEvent'][] = 'ThanksHooks::onBeforeCreateEchoEvent';
$wgHooks['EchoGetDefaultNotifiedUsers'][] =
'ThanksHooks::onEchoGetDefaultNotifiedUsers';
+$wgHooks['AddNewAccount'][] = 'ThanksHooks::onAccountCreated';
// Register modules
$wgResourceModules['ext.thanks'] = array(
@@ -97,4 +98,5 @@
// Set default user options
$wgDefaultUserOptions['echo-subscriptions-web-edit-thank'] = true;
+// This is overriden for new users in ThanksHooks::onAccountCreated
$wgDefaultUserOptions['echo-subscriptions-email-edit-thank'] = false;
--
To view, visit https://gerrit.wikimedia.org/r/61152
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1aa81cf81ca71af323f0d5448fb5800086a09b1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits