Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/215259
Change subject: Improve registration of Echo notifications ...................................................................... Improve registration of Echo notifications * Use BeforeCreateEchoEvent hook instead of an extension function * Register hooks unconditionally, if Echo is not installed they will never be called Change-Id: I312e27f41b964255478c48f5bb780ce2dbd7b025 --- M Flow.php M Hooks.php M includes/Notifications/Controller.php 3 files changed, 12 insertions(+), 27 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/59/215259/1 diff --git a/Flow.php b/Flow.php index afe08de..e2344da 100644 --- a/Flow.php +++ b/Flow.php @@ -155,6 +155,11 @@ // not be LiquidThreads talk pages. $wgHooks['LiquidThreadsIsLqtPage'][] = 'FlowHooks::onIsLiquidThreadsPage'; +// Echo integration +$wgHooks['BeforeCreateEchoEvent'][] = 'Flow\NotificationController::onBeforeCreateEchoEvent'; +$wgHooks['EchoGetDefaultNotifiedUsers'][] = 'Flow\NotificationController::getDefaultNotifiedUsers'; +$wgHooks['EchoGetBundleRules'][] = 'Flow\NotificationController::onEchoGetBundleRules'; + // Extension initialization $wgExtensionFunctions[] = 'FlowHooks::initFlowExtension'; diff --git a/Hooks.php b/Hooks.php index e375381..c43014d 100644 --- a/Hooks.php +++ b/Hooks.php @@ -98,11 +98,6 @@ // needed to determine if a page is occupied by flow self::getOccupationController(); - // necessary to render flow notifications - if ( class_exists( 'EchoNotifier' ) ) { - NotificationController::setup(); - } - // necessary to provide flow options in abuse filter on-wiki pages global $wgFlowAbuseFilterGroup; if ( $wgFlowAbuseFilterGroup ) { diff --git a/includes/Notifications/Controller.php b/includes/Notifications/Controller.php index eb7815b..58b8d21 100644 --- a/includes/Notifications/Controller.php +++ b/includes/Notifications/Controller.php @@ -26,32 +26,17 @@ $this->language = $language; } - /** - * Set up Echo notification for Flow extension - */ - public static function setup() { - global $wgHooks, - $wgEchoNotifications, $wgEchoNotificationIcons, $wgEchoNotificationCategories; - - $wgHooks['EchoGetDefaultNotifiedUsers'][] = 'Flow\NotificationController::getDefaultNotifiedUsers'; - $wgHooks['EchoGetBundleRules'][] = 'Flow\NotificationController::onEchoGetBundleRules'; - - /** - * Load notification definitions from file. - * @var $notifications array[] - */ - $wgEchoNotifications += require( __DIR__ . "/Notifications.php" ); - - $wgEchoNotificationIcons['flow-discussion'] = array( + public static function onBeforeCreateEchoEvent( &$notifications, &$categories, &$icons ) { + $notifications += require __DIR__ . "/Notifications.php"; + $categories['flow-discussion'] = array( + 'priority' => 3, + 'tooltip' => 'echo-pref-tooltip-flow-discussion', + ); + $icons['flow-discussion'] = array( 'path' => array( 'ltr' => 'Flow/modules/notification/icon/Talk-ltr.png', 'rtl' => 'Flow/modules/notification/icon/Talk-rtl.png' ) - ); - - $wgEchoNotificationCategories['flow-discussion'] = array( - 'priority' => 3, - 'tooltip' => 'echo-pref-tooltip-flow-discussion', ); } -- To view, visit https://gerrit.wikimedia.org/r/215259 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I312e27f41b964255478c48f5bb780ce2dbd7b025 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits