jenkins-bot has submitted this change and it was merged. Change subject: Register preferences as 'api' type ......................................................................
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. Bug: 39503 Change-Id: I5439a5f47b3bb05f4dab26139b0dc52d0ecd62c8 --- M TranslationNotifications.php M TranslationNotificationsHooks.php 2 files changed, 20 insertions(+), 0 deletions(-) Approvals: Siebrand: Looks good to me, approved jenkins-bot: Verified diff --git a/TranslationNotifications.php b/TranslationNotifications.php index 16d7c7e..dd7cac6 100644 --- a/TranslationNotifications.php +++ b/TranslationNotifications.php @@ -80,3 +80,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: merged Gerrit-Change-Id: I5439a5f47b3bb05f4dab26139b0dc52d0ecd62c8 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/TranslationNotifications Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits