Kmuthu has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344563 )

Change subject: Set feature flag for TheWikiepdiaLibrary extension
......................................................................

Set feature flag for TheWikiepdiaLibrary extension

Bug: T132084
Change-Id: I8e516d8675a244f5eac0e9539078d54346509af6
---
M Hooks.php
M extension.json
2 files changed, 8 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TheWikipediaLibrary 
refs/changes/63/344563/1

diff --git a/Hooks.php b/Hooks.php
index 416e93d..2ded005 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -19,7 +19,7 @@
        public static function onBeforeCreateEchoEvent(
                &$notifications, &$notificationCategories, &$icons
        ) {
-               $notificationCategories['twl-eligible'] = [
+               $notificationCategories['system'] = [
                        'priority' => 9
                ];
 
@@ -27,7 +27,7 @@
                        EchoAttributeManager::ATTR_LOCATORS => [
                                'EchoUserLocator::locateEventAgent'
                        ],
-                       'category' => 'twl-eligible',
+                       'category' => 'system',
                        'group' => 'positive',
                        'section' => 'message',
                        'presentation-model' => 'TwlEligiblePresentationModel'
@@ -39,17 +39,6 @@
 
                return true;
        }
-
-       // public static function onEchoGetDefaultNotifiedUsers( EchoEvent 
$event, &$users ) {
-       //      if ( $event->getType() === 'twl-eligible') {
-       //              $userAgent = $event->getAgent();
-       //              $recipientId = $userAgent->getId();
-       //              $recipient = User::newFromId( $recipientId );
-       //              $users[$recipientId] = $recipient;
-       //              return true;
-       //      }
-       //
-       // }
 
        /**
         * Use this hook to remove feed links from the head
@@ -69,7 +58,7 @@
                // if the user has 500 edits and has been registered for 6 
months give access
                // to the-wikipedia-library database
                DeferredUpdates::addCallableUpdate( function () use ( $user, 
$title ) {
-                       global $wgTwlEditCount, $wgTwlRegistrationDays, 
$wgTwlRegistrationHours, $wgTwlRegistrationSeconds;
+                       global $wgTwlEditCount, $wgTwlRegistrationDays, 
$wgTwlRegistrationHours, $wgTwlRegistrationSeconds, $wgTwlSendNotifications;
                        $twlRegistrationPeriod = $wgTwlRegistrationDays * 
$wgTwlRegistrationHours * $wgTwlRegistrationSeconds;
 
                        // notify the user only once about the twl-eligibility
@@ -81,7 +70,7 @@
                        $registration_timestamp = wfTimestamp( TS_UNIX, 
$user->getRegistration() );
                        $lastedit_timestamp = wfTimestamp( TS_UNIX, 
wfTimestampNow( TS_UNIX ) );
                        $eligibility_period_timestamp = $lastedit_timestamp - 
$registration_timestamp;
-                       if ( $user->getEditCount() >= $wgTwlEditCount && 
$eligibility_period_timestamp >= $twlRegistrationPeriod ) {
+                       if ( $wgTwlSendNotifications && $user->getEditCount() 
>= $wgTwlEditCount && $eligibility_period_timestamp >= $twlRegistrationPeriod ) 
{
                                EchoEvent::create( array(
                                        'type' => 'twl-eligible',
                                                'agent' => $user,
diff --git a/extension.json b/extension.json
index 154b07f..e7ea2d8 100644
--- a/extension.json
+++ b/extension.json
@@ -28,11 +28,12 @@
                ]
        },
        "config": {
-               "TwlUserPrimaryUrl": 
"https://meta.wikimedia.org/wiki/The_Wikipedia_Library/Databases";,
+               "TwlUserPrimaryUrl": "https://wikipedialibrary.wmflabs.org/";,
                "TwlUserSecondaryUrl": 
"https://meta.wikimedia.org/wiki/The_Wikipedia_Library";,
-               "TwlRegistrationDays": 70,
+               "TwlSendNotifications": true,
+               "TwlRegistrationDays": 182,
                "TwlRegistrationHours": 24,
                "TwlRegistrationSeconds": 3600,
-               "TwlEditCount": 250
+               "TwlEditCount": 500
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e516d8675a244f5eac0e9539078d54346509af6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TheWikipediaLibrary
Gerrit-Branch: master
Gerrit-Owner: Kmuthu <kavithamuth...@gmail.com>

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

Reply via email to