Directly constructing SpecialPages is bad, they're not @newable
and core can change constructor signatures without deprecation
and break the tests.
Change-Id: Ifc82d29a00d3fd136c44e0699e6bbfa11b8cf2a6
We're working on code in DiscussionTools that generates Echo events for
adding talk page comments (I7e0996843cdd70141e19d5c7ce66122204efa1b7),
and it was causing this test to fail.
Change-Id: I3099473a3113962911b9c77ede290142857a51b2
Adds AttributeManager to EchoServices so that dependencies of
AttributeManager can be injected.
Bug: T275148
Change-Id: I4fa5084d72914d16b6d218e7dd3521f5a1919b80
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Commenting.PropertyDocumentation.MissingVar
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage
Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).
Change-Id: I46e3dacb3da1266ff52d614003ad911feeb7504e
* EchoEvent now supports `extra` params for job delay and deduplication
* When Echo identifies this type of param it creates a
DelayedEchoNotificationJob that will be executed after `delay` seconds
Change-Id: Ib0c6789dfe42e9703a67835909e5932c0054089f
It appears like the initial \h in this non-Unicode regular
expression matches parts of an UTF-8 character, destroying it.
This makes the final preg_match() in this method fail, when
$output is going to be used as a pattern.
Bug: T264922
Change-Id: Iaf240bc2e0808c2f57c1f8bab2589d3207915afe
Since its a unit test, the use of User::newFromId
prevents attempts in core to migrate to
the UserFactory.
Change-Id: If5e76f2ae570ef4ae58cb77b5281c4446a1cadff
EchoAttributeManager::getUserCallable casts to array,
which means that even a non-array value (e.g. a simple callback)
becomes an array and NotificationController::evaluateUserCallable
will handle it just fine. But tests seemed to thing it was wrong.
Change-Id: Ia1e1e4015ebbc4d79bba5274e802911f222692c0
Use the mock HTTP request, in preparation for I1702c11928f87
Depends-On: I8ce17da7315b87b8dd0e502e601b9ac488089456
Needed-By: I1702c11928f8760bb41b41f4c7c04d7af03f62e2
Bug: T262443
Change-Id: I390856b4609635cee22253071f21ce63ff716791
* DB changes
- Create a table for push topics NameTableStore
- Add a foreign key on subscriptions to normalize push topics
* Implement NameTableStore to normalize topics
* Update DB query joins to include topic from foreignkey
* Adapt code to use IDs instead of the actual topic
Bug: T261756
Change-Id: Ia7589f4a607993352d45b2dd3bcb3867d12d6e97
Currently Echo assumes the default user used when ->editPage() is
called to be a sysop user… which is kind of the case? It passed null
to WikiPage::doEditContent() which in turn falls back to the default
user (127.0.0.1). In a test that relies on the user to be a sysop, it's
better to provide the user explicitly to avoid confusion.
This is to clean up the confusion introduced by ->editPage()'s doc
block, see: I9f77474f40e0f6901aa2c6f846e471b822636aa5
Change-Id: I7a79e0eaa1617e4d87a8d615a5391723c0e30b6a
Creates a new push-subscription-manager group and an associated
right, manage-all-push-subscriptions. The purpose of this is to
allow privileged accounts to purge expired subscriptions from the
database on behalf of other users. A user with this right will be
permitted to delete any subscription from the DB based on the token
alone. For all other users, deletion requests will be limited to
those associated with the requesting user's central ID.
This right will be granted to a bot account on Metawiki associated
with the Wikimedia push notifications service, and the push
notifications service account will make push subscription delete
requests to the API for subscriptions for which vendor APIs return bad
subscription responses.
Additionally, the providertoken parameter to ApiPushSubscriptionDelete
is updated to allow multiple providertoken values.
Bug: T259148
Change-Id: Ia6c17588ee94e6be74e5e3a75eb33e38f172fc93
1) send apns topic when present in subscription metadata
2) check if subscription metadata is a valid JSON string
3) make epp_id column at echo_push_provider table auto_increment,
otherwise it will fail when trying to add a second row in the table
Bug: T259394
Change-Id: I785435e9f2d4ba9c14977d431d271f0fa2d0c795
Both styles create the exact same object. Casting an array to an
object creates an stdClass object as well. The main benefit of this
syntax is that there is much less repetition. Everything is one
token instead of individual lines, where each line might contain a
typo.
Change-Id: Id43fa2c4b6bd5d9dbc60008427d4a9e14ae3811c
Creates a EchoPushMaxSubscriptionsPerUser config setting (default: 0)
that controls the maximum number of subscriptions a user may associate
with the user's central user ID.
The setting is enforced in EchoPush\SubscriptionManager::create().
To allow creating push subscriptions for development, set
$wgEchoPushMaxSubscriptionsPerUser to a positive integer value in
LocalSettings.php:
$wgEchoPushMaxSubscriptionsPerUser = 10;
Bug: T259150
Change-Id: Ib97b6b6cbb8161dd75dad92c54b4fe4fff80c421
Adds additional job parameters to help diagnose the apparent issue of
jobs being performed twice on Beta.
Bug: T255068
Change-Id: Ib257a24056539487e1110fe286fa4535c3fec94a
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
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
* Add a section on the preference form to allow users to mute articles
from generating "page linked" notices
* The preference will save the article title as an article ID
Depends-On: Ia0ddf78646ec4c8ae0b84b6d5b46ef5e51c8e8c1
Bug: T46787
Change-Id: I67f751eae5fdc5bccff7fe3047227d432c1cb8d5
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Usage.ForbiddenFunctions.isset
* MediaWiki.Usage.PHPUnitDeprecatedMethods.AssertInternalTypeGeneric
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.
Change-Id: I29416247ff3736799543926813beaf4afd569a6e