The nicer approach would be setting the parameter default to [],
but that breaks ApiSandbox.
Bug: T254699
Change-Id: I6c553e27248ff7d6c696f116cb34eb238dade440
Rather than catching all DB errors (and assuming they are duplicate
entry errors), ignore duplicate entry errors and use affectedRows() to
determine whether the subscription already existed.
Change-Id: I4d50cb8222e52cc1a4e1f0fb3f596f36cb565dbb
Finishes the implementation of the stubbed NotificationServiceClient.
Sends push notification request messages to the endpoint configured in
the EchoPushServiceBaseUrl setting. For example, to send messages to an
instance of mediawiki/services/push-notifications running on the host
machine while running MediaWiki in Docker, add the following line to
LocalSettings.php:
$wgEchoPushServiceBaseUrl = 'http://172.17.0.1:8900/v1/message';
Bug: T252899
Change-Id: Icab7825e9080d6b1a4cfc5e12fed1da221ce4610
Updates the push subscription query to retrieve a provider string rather
than only its numeric internal ID.
Change-Id: I910173409e48e8b6a6739d3122165c40b0d52b7f
- Automatically flip the position if there's no room
- Always flip the position in bundled notifications
- Remove menuWidth and related hacks, they didn't work anyway
- Increase maximum label width a bit
Change-Id: I490a925b6265bfbb8bbedae11672fd19d4efba44
Provides a basic push notifier implementation. Since the push service is
not yet in place, all it does for now is log debug output when a
notification is to be sent.
To register the push notifier, add the following configuration to
LocalSettings.php:
$wgEchoNotifiers['push'] = [ 'EchoPush\\PushNotifier', 'notifyWithPush' ];
$wgDefaultNotifyTypeAvailability['push'] = true;
$wgNotifyTypeAvailabilityByCategory['system']['push'] = false;
$wgNotifyTypeAvailabilityByCategory['system-noemail']['push'] = false;
We'll register the notifier in configuration for now, rather than
hard-coding the default in extension.json, in order to have control over
when and where it rolls out (beta vs. prod, as well as which wikis).
Since the push notifier implementation depends on jobs being processed
by the job queue, I also recommend adding the following configuration
setting to ensure that all pending jobs are processed at the end of each
web request:
// ensure all pending jobs are processed when a web request completes
$wgJobRunRate = PHP_INT_MAX;
Bug: T252899
Change-Id: Ie7f222443045d30620ff297b006104ef18a074a8
Adds DB tables for storing push subscriptions, some DB interaction code
for retrieving them within MediaWiki, and a set of API modules for
managing them from the outside world.
When testing this patch, be sure to run maintenance/update.php to create
the new tables, and set $wgEchoEnablePush = true in LocalSettings.php
to enable the API new API module.
N.B. The current DB schema is centered on app push subscriptions. Web
push subscriptions require slightly different handling, since they are
provided by browsers as a JSON blob rather than a token string. How to
handle web push subscriptions is a question we can defer until the time
comes to add web push support.
Subscription data is stored in the echo_push_subscription table, with
provider names normalized into the echo_push_provider table. We expect to
be looking up subscriptions by central user ID, so that column is indexed.
The subscription data also includes a column to store SHA256 digests of
the subscriber tokens. This is for use as a unique key constraint, since
we expect every push token to be univerally unique, and the token values
themselves may be too large to reasonably index in MySQL.
Bug: T252899
Change-Id: I3928761b3fba12e54ff4850e9a05c68ec7772f62
The following sniffs are failing and were disabled:
* Generic.Files.LineLength.TooLong
Additional changes:
* Replaced "jakub-onderka" packages with "php-parallel-lint".
Change-Id: Ibe6a0bc27cefd6da49192032785ed4ee00c56587
If/when we add other notification types, we could switch this string back to
"Muted pages" and nest other notification types underneath, or we could use a
different UI pattern for exposing those preferences.
Bug: T46787
Change-Id: I66cb2795a17994197b8610d04691dfca55ebc588