Amire80 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/56922
Change subject: (bug 39503) Register preferences as 'api' type
......................................................................
(bug 39503) Register preferences as 'api' type
The preferences weren't registered, so changing any other preferences
caused the translationnotifications-* preferences to be deleted.
This change prevents unwanted deletion of data and confusion
about the current preferences.
Change-Id: I5439a5f47b3bb05f4dab26139b0dc52d0ecd62c8
---
M TranslationNotifications.php
M TranslationNotificationsHooks.php
2 files changed, 21 insertions(+), 0 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslationNotifications
refs/changes/22/56922/1
diff --git a/TranslationNotifications.php b/TranslationNotifications.php
index 16d7c7e..973bba7 100644
--- a/TranslationNotifications.php
+++ b/TranslationNotifications.php
@@ -69,6 +69,7 @@
$wgLogTypes[] = 'notifytranslators';
$wgLogActionsHandlers['notifytranslators/sent'] =
'TranslationNotificationsHooks::formatTranslationNotificationLogEntry';
+
$wgNotificationUsername = false;
$wgNotificationUserPassword = false;
@@ -80,3 +81,5 @@
foreach ( range( 1, 3 ) as $langNum ) {
$wgDefaultUserOptions["translationnotifications-lang-$langNum"] = '';
}
+
+$wgHooks['GetPreferences'][] =
'TranslationNotificationsHooks::onGetPreferences';
diff --git a/TranslationNotificationsHooks.php
b/TranslationNotificationsHooks.php
index 03a6579..cab2d60 100644
--- a/TranslationNotificationsHooks.php
+++ b/TranslationNotificationsHooks.php
@@ -68,4 +68,22 @@
$languageCount // $10
)->inLanguage( $language )->text();
}
+
+ public static function onGetPreferences( $user, &$preferences ) {
+ foreach ( array(
+ 'translationnotifications-lang-1',
+ 'translationnotifications-lang-2',
+ 'translationnotifications-lang-3',
+ 'translationnotifications-cmethod-email',
+ 'translationnotifications-cmethod-talkpage',
+
'translationnotifications-cmethod-talkpage-elsewhere-loc',
+ 'translationnotifications-freq',
+ ) as $preference ) {
+ $preferences[$preference] = array(
+ 'type' => 'api',
+ );
+ }
+
+ return true;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/56922
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5439a5f47b3bb05f4dab26139b0dc52d0ecd62c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits