Page MenuHomePhabricator

Add push notification support to Echo
Closed, ResolvedPublic

Description

As agreed in recent discussions, we will be adding push support directly to Echo rather than building and launching the same functionality in a new MediaWiki extension. This task is to implement that support, including

  • subscription management
  • a new 'push' notifier type for submitting notifications to the service for pushing to users

For Phase 1, only app push support is needed. Web push support will be added in Phase 2.

IMPORTANT: Ensure that all user-visible push functionality (e.g., Action API modules, notification preferences) is feature-flagged.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 15 2020, 5:30 PM
Mholloway triaged this task as High priority.May 15 2020, 5:30 PM
Mholloway updated the task description. (Show Details)
Mholloway updated the task description. (Show Details)May 15 2020, 5:33 PM
Mholloway updated the task description. (Show Details)
Restricted Application added a project: Growth-Team. · View Herald TranscriptMay 15 2020, 5:44 PM
Mholloway added a subscriber: Catrope.EditedMay 15 2020, 8:30 PM

@Catrope I've been down a rabbit hole this afternoon trying to figure out what to do about the new echopushsubscriptions Action API module that I'd like to land on master but won't really be ready for use for a while. It doesn't look like there's any clean way of suppressing a registered API module from the main module's help page. Is the best option just to disable it in production with $wgAPIModules['echopushsubscriptions'] = 'ApiDisabled'; until we actually want to open it up for production usage? Thanks!

Mholloway added a comment.EditedMay 15 2020, 8:37 PM

Hmm... poking around CommonSettings.php, looks like we could even do something like

if ( $wmfRealm === 'production' ) {
  unset( $wgAPIModules['echopushsubscriptions'] );
}

That way it we'd leave it in place for testing on the Beta Cluster.

Mholloway added a comment.EditedMay 15 2020, 8:42 PM

Maybe better still to do

if ( !$wgEchoEnablePush ) {
  unset( $wgAPIModules['echopushsubscriptions'] );
}

and then ensure that wgEchoEnablePush is true on BC but false in production.

Well, the unset() approach doesn't seem to work, at least locally, becuase the API modules don't appear to be initialized yet at the point the settings (here LocalSettings.php) are processed.

Anyway, it's marked internal, so maybe it's OK just to let it be.

Ah, here we go.

/**
 * Hook handler for ApiMain::moduleManager
 * TODO: Register this the usual way in extension.json when we don't need the feature flag
 *  anymore.
 * @param ApiModuleManager $moduleManager
 */
public static function onApiMainModuleManager( ApiModuleManager $moduleManager ) {
	$services = MediaWikiServices::getInstance();
	$echoConfig = $services->getConfigFactory()->makeConfig( 'Echo' );
	$pushEnabled = $echoConfig->get( 'EchoEnablePush' );
	if ( $pushEnabled ) {
		$moduleManager->addModule(
			'echopushsubscriptions',
			'action',
			'EchoPush\\Api\\ApiEchoPushSubscriptions'
		);
	}
}

Change 597135 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[mediawiki/extensions/Echo@master] Add push subscription management

https://gerrit.wikimedia.org/r/597135

Change 598126 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[mediawiki/extensions/Echo@master] Add push notifier

https://gerrit.wikimedia.org/r/598126

Change 597135 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Add push subscription management

https://gerrit.wikimedia.org/r/597135

Change 598126 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Add push notifier

https://gerrit.wikimedia.org/r/598126

Change 601906 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[mediawiki/extensions/Echo@master] Push: Implement request submission to configured service endpoint

https://gerrit.wikimedia.org/r/601906

Change 601906 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Push: Submit requests to configured service endpoint

https://gerrit.wikimedia.org/r/601906

Change 604115 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[operations/mediawiki-config@master] Echo: Enable push subscription management API (BETA)

https://gerrit.wikimedia.org/r/604115

Change 604116 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[operations/mediawiki-config@master] Echo: Enable push notifier (BETA)

https://gerrit.wikimedia.org/r/604116

Change 604115 merged by jenkins-bot:
[operations/mediawiki-config@master] Echo: Enable push subscription management API (BETA)

https://gerrit.wikimedia.org/r/604115

Change 604116 merged by jenkins-bot:
[operations/mediawiki-config@master] Echo: Enable push notifier (BETA)

https://gerrit.wikimedia.org/r/604116

MSantos closed this task as Resolved.Jun 24 2020, 3:06 PM