jenkins-bot has submitted this change and it was merged.
Change subject: Add support for splitting notifications into alert & message
......................................................................
Add support for splitting notifications into alert & message
Change-Id: I8eeeeb9a7a1539a258bc42584274897f9e7dc775
---
M Echo.php
M api/ApiEchoMarkRead.php
M api/ApiEchoNotifications.php
M includes/AttributeManager.php
M includes/NotifUser.php
M model/Event.php
M model/Notification.php
M tests/includes/AttributeManagerTest.php
8 files changed, 432 insertions(+), 40 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Echo.php b/Echo.php
index 159ba31..02c92af 100644
--- a/Echo.php
+++ b/Echo.php
@@ -363,6 +363,7 @@
),
'category' => 'system',
'group' => 'positive',
+ 'section' => 'alert',
'title-message' => 'notification-new-user',
'title-params' => array( 'agent' ),
'icon' => 'site',
@@ -375,6 +376,7 @@
'secondary-link' => array( 'message' =>
'notification-link-text-view-changes', 'destination' => 'diff' ),
'category' => 'edit-user-talk',
'group' => 'interactive',
+ 'section' => 'alert',
'bundle' => array( 'web' => true, 'email' => false ),
'formatter-class' => 'EchoEditUserTalkFormatter',
'title-message' => 'notification-edit-talk-page2',
@@ -398,6 +400,7 @@
'primary-link' => array( 'message' =>
'notification-link-text-view-edit', 'destination' => 'diff' ),
'category' => 'reverted',
'group' => 'negative',
+ 'section' => 'alert',
'formatter-class' => 'EchoEditFormatter',
'title-message' => 'notification-reverted2',
'title-params' => array( 'agent', 'title', 'difflink', 'number'
),
@@ -416,6 +419,7 @@
'primary-link' => array( 'message' =>
'notification-link-text-view-page', 'destination' => 'link-from-page' ),
'category' => 'article-linked',
'group' => 'neutral',
+ 'section' => 'alert',
'bundle' => array( 'web' => true, 'email' => true ),
'formatter-class' => 'EchoPageLinkFormatter',
'title-message' => 'notification-page-linked',
@@ -440,6 +444,7 @@
'secondary-link' => array( 'message' =>
'notification-link-text-view-changes', 'destination' => 'diff' ),
'category' => 'mention',
'group' => 'interactive',
+ 'section' => 'alert',
'formatter-class' => 'EchoMentionFormatter',
'title-message' => 'notification-mention',
'title-params' => array( 'agent', 'subject-anchor', 'title',
'section-title', 'main-title-text' ),
@@ -458,6 +463,7 @@
'primary-link' => array( 'message' => 'echo-learn-more',
'destination' => 'user-rights-list' ),
'category' => 'user-rights',
'group' => 'neutral',
+ 'section' => 'alert',
'formatter-class' => 'EchoUserRightsFormatter',
'title-message' => 'notification-user-rights',
'title-params' => array( 'agent', 'user-rights-list' ),
diff --git a/api/ApiEchoMarkRead.php b/api/ApiEchoMarkRead.php
index 5a2a387..ef39116 100644
--- a/api/ApiEchoMarkRead.php
+++ b/api/ApiEchoMarkRead.php
@@ -28,7 +28,17 @@
$rawCount = $notifUser->getNotificationCount();
$result = array(
- 'result' => 'success',
+ 'result' => 'success'
+ );
+ $rawCount = 0;
+ foreach ( EchoAttributeManager::$sections as $section ) {
+ $rawSectionCount = $notifUser->getNotificationCount( /*
$tryCache = */true, DB_SLAVE, $section );
+ $result[$section]['rawcount'] = $rawSectionCount;
+ $result[$section]['count'] =
EchoNotificationController::formatNotificationCount( $rawSectionCount );
+ $rawCount += $rawSectionCount;
+ }
+
+ $result += array(
'rawcount' => $rawCount,
'count' =>
EchoNotificationController::formatNotificationCount( $rawCount ),
);
diff --git a/api/ApiEchoNotifications.php b/api/ApiEchoNotifications.php
index d624b92..cb77768 100644
--- a/api/ApiEchoNotifications.php
+++ b/api/ApiEchoNotifications.php
@@ -16,27 +16,42 @@
}
$params = $this->extractRequestParams();
-
$prop = $params['prop'];
- $attributeManager = EchoAttributeManager::newFromGlobalVars();
$result = array();
if ( in_array( 'list', $prop ) ) {
- $result = $this->getPropList(
- $user,
- $attributeManager->getUserEnabledEvents( $user,
'web' ),
- $params['limit'], $params['continue'],
$params['format']
- );
- $this->getResult()->setIndexedTagName( $result['list'],
'notification' );
- // 'index' is built on top of 'list'
- if ( in_array( 'index', $prop ) ) {
- $result['index'] = $this->getPropIndex(
$result['list'] );
- $this->getResult()->setIndexedTagName(
$result['index'], 'id' );
+ // Group notification results by section
+ if ( $params['groupbysection'] ) {
+ foreach ( $params['sections'] as $section ) {
+ $result[$section] =
$this->getSectionPropList(
+ $user, $section,
$params['limit'],
+ $params[$section . 'continue'],
$params['format']
+ );
+ $this->getResult()->setIndexedTagName(
$result[$section]['list'], 'notification' );
+ // 'index' is built on top of 'list'
+ if ( in_array( 'index', $prop ) ) {
+ $result[$section]['index'] =
$this->getPropIndex( $result[$section]['list'] );
+
$this->getResult()->setIndexedTagName( $result[$section]['index'], 'id' );
+ }
+ }
+ } else {
+ $attributeManager =
EchoAttributeManager::newFromGlobalVars();
+ $result = $this->getPropList(
+ $user,
+
$attributeManager->getUserEnabledEventsbySections( $user, 'web',
$params['sections'] ),
+ $params['limit'], $params['continue'],
$params['format']
+ );
+ $this->getResult()->setIndexedTagName(
$result['list'], 'notification' );
+ // 'index' is built on top of 'list'
+ if ( in_array( 'index', $prop ) ) {
+ $result['index'] = $this->getPropIndex(
$result['list'] );
+ $this->getResult()->setIndexedTagName(
$result['index'], 'id' );
+ }
}
}
if ( in_array( 'count', $prop ) ) {
- $result += $this->getPropCount( $user );
+ $result += $this->getPropcount( $user,
$params['sections'], $params['groupbysection'] );
}
$this->getResult()->setIndexedTagName( $result, 'notification'
);
@@ -44,20 +59,49 @@
}
/**
- * Internal helper method for getting property 'count' data
- */
- protected function getPropCount( User $user ) {
- $result = array();
+ * Internal method for getting the property 'list' data for individual
section
+ * @param User $user
+ * @param string $section
+ * @param int $limit
+ * @param string $continue
+ * @param string $format
+ * @return array
+ */
+ protected function getSectionPropList( User $user, $section, $limit,
$continue, $format ) {
$notifUser = MWEchoNotifUser::newFromUser( $user );
- // Always get total count
- $rawCount = $notifUser->getNotificationCount();
- $result['rawcount'] = $rawCount;
- $result['count'] =
EchoNotificationController::formatNotificationCount( $rawCount );
+ $attributeManager = EchoAttributeManager::newFromGlobalVars();
+ $sectionEvents =
$attributeManager->getUserEnabledEventsbySections( $user, 'web', array(
$section ) );
+ // Some section like 'message' only has flow notifications,
which most wikis and
+ // users don't have, we should skip the query in such case
+ if ( !$sectionEvents || !$notifUser->shouldQuerySectionData(
$section ) ) {
+ $result = array(
+ 'list' => array(),
+ 'continue' => null
+ );
+ } else {
+ $result = $this->getPropList(
+ $user, $sectionEvents, $limit, $continue,
$format
+ );
+ // If events exist for applicable section we should set
the section status
+ // in cache to check whether a query should be
triggered in later request.
+ // This is mostly for users who don't have 'message'
notifications
+ if ( $sectionEvents ) {
+ $notifUser->setSectionStatusCache( $section,
count( $result['list'] ) );
+ }
+ }
return $result;
}
/**
- * Internal helper method for getting property 'list' data
+ * Internal helper method for getting property 'list' data, this is
based
+ * on the event types specified in the arguments and it could be event
types
+ * of a set of sections or a single section
+ * @param User $user
+ * @param string[] $eventTypesToLoad
+ * @param int $limit
+ * @param string $continue
+ * @param string $format
+ * @return array
*/
protected function getPropList( User $user, array $eventTypesToLoad,
$limit, $continue, $format ) {
$result = array(
@@ -81,7 +125,34 @@
}
/**
+ * Internal helper method for getting property 'count' data
+ * @param User $user
+ * @param string[] $sections
+ * @param boolean $groupBySection
+ * @return aray
+ */
+ protected function getPropCount( User $user, array $sections,
$groupBySection ) {
+ $result = array();
+ $notifUser = MWEchoNotifUser::newFromUser( $user );
+ // Always get total count
+ $rawCount = $notifUser->getNotificationCount();
+ $result['rawcount'] = $rawCount;
+ $result['count'] =
EchoNotificationController::formatNotificationCount( $rawCount );
+
+ if ( $groupBySection ) {
+ foreach ( $sections as $section ) {
+ $rawCount = $notifUser->getNotificationCount(
/* $tryCache = */true, DB_SLAVE, $section );
+ $result[$section]['rawcount'] = $rawCount;
+ $result[$section]['count'] =
EchoNotificationController::formatNotificationCount( $rawCount );
+ }
+ }
+ return $result;
+ }
+
+ /**
* Internal helper method for getting property 'index' data
+ * @param array $list
+ * @return array
*/
protected function getPropIndex( $list ) {
$result = array();
@@ -95,7 +166,8 @@
}
public function getAllowedParams() {
- return array(
+ $sections = EchoAttributeManager::$sections;
+ $params = array(
'prop' => array(
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => array(
@@ -105,6 +177,12 @@
),
ApiBase::PARAM_DFLT => 'list',
),
+ 'sections' => array(
+ ApiBase::PARAM_DFLT => implode( '|', $sections
),
+ ApiBase::PARAM_TYPE => $sections,
+ ApiBase::PARAM_ISMULTI => true,
+ ),
+ 'groupbysection' => false,
'format' => array(
ApiBase::PARAM_TYPE => array(
'text',
@@ -123,15 +201,23 @@
'continue' => null,
'uselang' => null
);
+ foreach ( $sections as $section ) {
+ $params[$section . 'continue'] = null;
+ }
+ return $params;
}
public function getParamDescription() {
return array(
'prop' => 'Details to request.',
+ 'sections' => 'The notification sections to query.',
+ 'groupbysection' => 'Whether to group the result by
section, each section is fetched separately if set',
'format' => 'If specified, notifications will be
returned formatted this way.',
'index' => 'If specified, a list of notification IDs,
in order, will be returned.',
'limit' => 'The maximum number of notifications to
return.',
- 'continue' => 'When more results are available, use
this to continue',
+ 'continue' => 'When more results are available, use
this to continue, this is used only when groupbysection is not set.',
+ 'alertcontinue' => 'When more alert results are
available, use this to continue.',
+ 'messagecontinue' => 'When more message results are
available, use this to continue.',
'uselang' => 'the desired language to format the output'
);
}
@@ -143,7 +229,7 @@
public function getExamples() {
return array(
'api.php?action=query&meta=notifications',
- 'api.php?action=query&meta=notifications¬prop=count',
+
'api.php?action=query&meta=notifications¬prop=count¬sections=alert|message¬groupbysection=1',
);
}
diff --git a/includes/AttributeManager.php b/includes/AttributeManager.php
index 4aac0a3..2840397 100644
--- a/includes/AttributeManager.php
+++ b/includes/AttributeManager.php
@@ -17,6 +17,22 @@
protected $categories;
/**
+ * Notification section constant
+ */
+ const ALERT = 'alert';
+ const MESSAGE = 'message';
+ const ALL = 'all';
+
+ /**
+ * Notifications are broken down to two sections, default is alert
+ * @var array
+ */
+ public static $sections = array (
+ self::ALERT,
+ self::MESSAGE
+ );
+
+ /**
* An array of EchoAttributeManager instance created from global
variables
* @param EchoAttributeManager[]
*/
@@ -95,12 +111,62 @@
}
/**
+ * Get the uesr enabled events for the specified sections
+ * @param User
+ * @param string
+ * @param string[]
+ * @return string[]
+ */
+ public function getUserEnabledEventsbySections( User $user,
$outputFormat, array $sections ) {
+ $events = array();
+ foreach ( $sections as $section ) {
+ $events = array_merge(
+ $events,
+ call_user_func(
+ array( $this, 'get' . ucfirst( $section
) . 'Events' )
+ )
+ );
+ }
+ return array_intersect(
+ $this->getUserEnabledEvents( $user, $outputFormat ),
+ $events
+ );
+ }
+
+ /**
* Get alert notification event. Notifications without a section
attributes
* default to section alert
* @return array
*/
- public function getEvents() {
- return array_keys( $this->notifications );
+ public function getAlertEvents() {
+ $events = array();
+ foreach ( $this->notifications as $event => $attribs ) {
+ if (
+ !isset( $attribs['section'] )
+ || !in_array( $attribs['section'],
self::$sections )
+ || $attribs['section'] === 'alert'
+ ) {
+ $events[] = $event;
+ }
+ }
+ return $events;
+ }
+
+ /**
+ * Get message notification event
+ * @return array
+ */
+ public function getMessageEvents() {
+ $events = array();
+ foreach ( $this->notifications as $event => $attribs ) {
+ if (
+ isset( $attribs['section'] )
+ && $attribs['section'] === 'message'
+ ) {
+ $events[] = $event;
+ }
+ }
+ return $events;
}
/**
@@ -165,4 +231,18 @@
}
return 'other';
}
+
+ /**
+ * Get notification section for a notification type
+ * @todo add a unit test case
+ * @parm string
+ * @return string
+ */
+ public function getNotificationSection( $notificationType ) {
+ if ( isset( $this->notifications[$notificationType]['section']
) ) {
+ return
$this->notifications[$notificationType]['section'];
+ }
+ return 'alert';
+ }
+
}
diff --git a/includes/NotifUser.php b/includes/NotifUser.php
index 6b446db..6a1a83a 100644
--- a/includes/NotifUser.php
+++ b/includes/NotifUser.php
@@ -24,6 +24,14 @@
private $userNotifGateway;
/**
+ * Whether to check cache for section status
+ */
+ static $sectionStatusCheckCache = array (
+ EchoAttributeManager::ALERT => false,
+ EchoAttributeManager::MESSAGE => true
+ );
+
+ /**
* Constructor for initialization
* @param User
* @param BagOStuff
@@ -49,6 +57,80 @@
return new MWEchoNotifUser(
$user, $wgMemc,
new EchoUserNotificationGateway( $user,
MWEchoDbFactory::newFromDefault() )
+ );
+ }
+
+ /**
+ * Check whether should trigger a query to fetch data for a section
when making
+ * such request. This method normally should return true for all
section.
+ * For some sections, it's better to save the result in cache and check
before
+ * triggering a query. Flow is in very limited deployment, Most *users
would
+ * not have flow notifications, it's better to save *this status in
cache
+ * to save a query. In addition, Flow notification is far less than
other
+ * notifications for most users at this moment. Querying could be
expensive
+ * in extreme cases
+ * @param string $section
+ * @return boolean
+ */
+ public function shouldQuerySectionData( $section ) {
+ if ( !self::$sectionStatusCheckCache[$section] ) {
+ return true;
+ }
+ $cacheVal = $this->cache->get( $this->sectionStatusCacheKey(
$section ) );
+ // '1' means should query
+ // '0' means should not query
+ // false means no cache and should query
+ if ( $cacheVal !== '0' ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Set section data status into cache, '1' means there is data for the
section,
+ * '0' means there is no data for this section
+ * @param string $section
+ * @param int $num
+ */
+ public function setSectionStatusCache( $section, $num ) {
+ if ( !self::$sectionStatusCheckCache[$section] ) {
+ return;
+ }
+ $key = $this->sectionStatusCacheKey( $section );
+ // Set cache for 5 days
+ if ( $num > 0 ) {
+ $this->cache->set( $key, '1', 432000 );
+ } else {
+ $this->cache->set( $key, '0', 432000 );
+ }
+ }
+
+ /**
+ * Clear section data cache for the section
+ * @param string
+ */
+ public function clearSectionStatusCache( $section ) {
+ if ( !self::$sectionStatusCheckCache[$section] ) {
+ return;
+ }
+ $this->cache->delete(
+ $this->sectionStatusCacheKey( $section )
+ );
+ }
+
+ /**
+ * Get the section data status cache key
+ * @param string $section
+ * @return string
+ */
+ protected function sectionStatusCacheKey( $section ) {
+ global $wgEchoConfig;
+ return wfMemcKey(
+ 'echo-notification-section-exist',
+ $section,
+ $this->mUser->getId(),
+ $wgEchoConfig['version']
);
}
@@ -120,25 +202,35 @@
* Retrieves number of unread notifications that a user has, would
return
* $wgEchoMaxNotificationCount + 1 at most
*
- * @param $cached bool Set to false to bypass the cache.
- * @param $dbSource int use master or slave database to pull count
- * @return integer: Number of unread notifications.
+ * @param boolean $cached Set to false to bypass the cache.
+ * @param int $dbSource Use master or slave database to pull count
+ * @param string $section Notification section
+ * @return int
*/
- public function getNotificationCount( $cached = true, $dbSource =
DB_SLAVE ) {
+ public function getNotificationCount( $cached = true, $dbSource =
DB_SLAVE, $section = EchoAttributeManager::ALL ) {
global $wgEchoConfig;
if ( $this->mUser->isAnon() ) {
return 0;
}
- $memcKey = wfMemcKey( 'echo-notification-count',
$this->mUser->getId(), $wgEchoConfig['version'] );
+ $memcKey = wfMemcKey(
+ 'echo-notification-count' . ( $section ===
EchoAttributeManager::ALL ? '' : ( '-' . $section ) ),
+ $this->mUser->getId(),
+ $wgEchoConfig['version']
+ );
if ( $cached && $this->cache->get( $memcKey ) !== false ) {
return (int)$this->cache->get( $memcKey );
}
$attributeManager = EchoAttributeManager::newFromGlobalVars();
- $eventTypesToLoad = $attributeManager->getUserEnabledEvents(
$this->mUser, 'web' );
+ if ( $section === EchoAttributeManager::ALL ) {
+ $eventTypesToLoad =
$attributeManager->getUserEnabledEvents( $this->mUser, 'web' );
+ } else {
+ $eventTypesToLoad =
$attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', array(
$section ) );
+ }
+
$count = $this->userNotifGateway->getNotificationCount(
$dbSource, $eventTypesToLoad );
$this->cache->set( $memcKey, $count, 86400 );
@@ -183,19 +275,23 @@
* @param $dbSource int use master or slave database to pull count
*/
public function resetNotificationCount( $dbSource = DB_SLAVE ) {
- $this->getNotificationCount( false, $dbSource );
+ // Reset notification count for all sections as well
+ $this->getNotificationCount( false, $dbSource,
EchoAttributeManager::ALL );
+ $this->getNotificationCount( false, $dbSource,
EchoAttributeManager::ALERT );
+ $this->getNotificationCount( false, $dbSource,
EchoAttributeManager::MESSAGE );
$this->mUser->invalidateCache();
}
/**
* Retrieves formatted number of unread notifications that a user has.
- * @param $cached bool Set to false to bypass the cache.
- * @param $dbSource int use master or slave database to pull count
- * @return String: Number of unread notifications.
+ * @param boolean $cached Set to false to bypass the cache.
+ * @param int $dbSource use master or slave database to pull count
+ * @param string $section
+ * @return string
*/
- public function getFormattedNotificationCount( $cached = true,
$dbSource = DB_SLAVE ) {
+ public function getFormattedNotificationCount( $cached = true,
$dbSource = DB_SLAVE, $section = EchoAttributeManager::ALL ) {
return EchoNotificationController::formatNotificationCount(
- $this->getNotificationCount( $cached, $dbSource )
+ $this->getNotificationCount( $cached, $dbSource,
$section )
);
}
diff --git a/model/Event.php b/model/Event.php
index 64be371..b78cf0c 100644
--- a/model/Event.php
+++ b/model/Event.php
@@ -426,6 +426,15 @@
return $attributeManager->getNotificationCategory( $this->type
);
}
+ /**
+ * Get the section of the event type
+ * @return string
+ */
+ public function getSection() {
+ $attributeManager = EchoAttributeManager::newFromGlobalVars();
+ return $attributeManager->getNotificationSection( $this->type );
+ }
+
public function setType( $type ) {
$this->type = $type;
}
diff --git a/model/Notification.php b/model/Notification.php
index 8f93ad2..6e00ed6 100644
--- a/model/Notification.php
+++ b/model/Notification.php
@@ -116,6 +116,11 @@
$notifMapper->insert( $this );
+ // Clear applicable section status from cache upon new
notification creation
+ MWEchoNotifUser::newFromUser( $this->user
)->clearSectionStatusCache(
+ $this->event->getSection()
+ );
+
wfRunHooks( 'EchoCreateNotificationComplete', array( $this ) );
}
diff --git a/tests/includes/AttributeManagerTest.php
b/tests/includes/AttributeManagerTest.php
index b180afd..cc23cb0 100644
--- a/tests/includes/AttributeManagerTest.php
+++ b/tests/includes/AttributeManagerTest.php
@@ -176,6 +176,58 @@
$this->assertEquals( 10, $manager->getNotificationPriority(
'event_four' ) );
}
+ public function testGetMessageEvents() {
+ $notif = array(
+ 'event_one' => array (
+ 'category' => 'category_one',
+ 'section' => 'message'
+ ),
+ 'event_two' => array (
+ 'category' => 'category_two'
+ ),
+ 'event_three' => array (
+ 'category' => 'category_three',
+ 'section' => 'message'
+ ),
+ 'event_four' => array (
+ 'category' => 'category_four'
+ )
+ );
+ $category = array(
+ 'category_one' => array (
+ 'priority' => 6
+ )
+ );
+ $manager = new EchoAttributeManager( $notif, $category );
+ $this->assertEquals( $manager->getMessageEvents(), array(
'event_one', 'event_three' ) );
+ }
+
+ public function testGetAlertEvents() {
+ $notif = array(
+ 'event_one' => array (
+ 'category' => 'category_one',
+ 'section' => 'message'
+ ),
+ 'event_two' => array (
+ 'category' => 'category_two'
+ ),
+ 'event_three' => array (
+ 'category' => 'category_three',
+ 'section' => 'alert'
+ ),
+ 'event_four' => array (
+ 'category' => 'category_four'
+ )
+ );
+ $category = array(
+ 'category_one' => array (
+ 'priority' => 6
+ )
+ );
+ $manager = new EchoAttributeManager( $notif, $category );
+ $this->assertEquals( $manager->getAlertEvents(), array(
'event_two', 'event_three', 'event_four' ) );
+ }
+
public function testGetUserEnabledEvents() {
$notif = array(
'event_one' => array (
@@ -209,6 +261,54 @@
$this->assertEquals( $manager->getUserEnabledEvents(
$this->mockUser(), 'web' ), array( 'event_two', 'event_three' ) );
}
+ public function testGetUserEnabledEventsbySections() {
+ $notif = array(
+ 'event_one' => array (
+ 'category' => 'category_one'
+ ),
+ 'event_two' => array (
+ 'category' => 'category_two',
+ 'section' => 'message'
+ ),
+ 'event_three' => array (
+ 'category' => 'category_three',
+ 'section' => 'alert'
+ ),
+ 'event_four' => array (
+ 'category' => 'category_three',
+ ),
+ );
+ $category = array(
+ 'category_one' => array (
+ 'priority' => 10,
+ ),
+ 'category_two' => array (
+ 'priority' => 10,
+ ),
+ 'category_three' => array (
+ 'priority' => 10
+ ),
+ );
+ $manager = new EchoAttributeManager( $notif, $category );
+ $expected = array( 'event_one', 'event_three', 'event_four' );
+ $actual = $manager->getUserEnabledEventsBySections(
$this->mockUser(), 'web', array( 'alert' ) );
+ sort( $expected );
+ sort( $actual );
+ $this->assertEquals( $actual, $expected );
+
+ $expected = array( 'event_two' );
+ $actual = $manager->getUserEnabledEventsBySections(
$this->mockUser(), 'web', array( 'message' ) );
+ sort( $expected );
+ sort( $actual );
+ $this->assertEquals( $actual, $expected );
+
+ $expected = array( 'event_one', 'event_two', 'event_three',
'event_four' );
+ $actual = $manager->getUserEnabledEventsBySections(
$this->mockUser(), 'web', array( 'message', 'alert' ) );
+ sort( $expected );
+ sort( $actual );
+ $this->assertEquals( $actual, $expected );
+ }
+
/**
* Mock object of User
*/
--
To view, visit https://gerrit.wikimedia.org/r/151974
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8eeeeb9a7a1539a258bc42584274897f9e7dc775
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits