Commit graph

1346 commits

Author SHA1 Message Date
Roan Kattouw c87cae39d7 Make Echo QUnit tests run again
The automatic registration for these was broken, because
$wgResourceModules no longer contains Echo's modules (since they are now
registered in extension.json).

Instead, add the test files in tests/qunit/model/ explicitly in
onResourceLoaderTestModules. The tests in tests/qunit/mobile/ are
already added through QUnitTestModule in extension.json.

Delete the ext.echo.overlay tests, they were testing code that was
removed years ago.

Bug: T258818
Change-Id: I7b996dc8631a86033830cf532f1b8e85251788ad
2020-07-24 13:26:34 -07:00
jenkins-bot f44df2f728 Merge "Make default snippet length (150) a constant" 2020-07-24 00:03:15 +00:00
Ed Sanders 1b40b69481 Make default snippet length (150) a constant
Change-Id: Idb53b226618fa0d625c7e4713c780538bd6a76ea
2020-07-23 13:00:44 +01:00
jenkins-bot 3ea911c8a9 Merge "DiscussionParser: Use strict (in)equality" 2020-07-23 10:03:45 +00:00
Ed Sanders b5c919db25 DiscussionParser: Use strict (in)equality
Change-Id: I7c6a8453a5f7a6603c8f8c173e5bcfd3cafc25d6
2020-07-22 21:50:54 +01:00
Kosta Harlan 910df7a190 Use user IDs, not User objects, for reverted-user-id
The Revision->RevisionStore migration accidentally injected User
objects for reverted-user-id in two different places at different times.
This doesn't break, because there's backwards compatibility logic that
handles User objects appropriately, but we shouldn't be doing this.

Co-authored-by: Roan Kattouw <roan.kattouw@gmail.com>
Change-Id: I4170c207c3d4fc7f0d869c0b367b53389a70ce80
2020-07-21 13:19:30 +02:00
Kosta Harlan 07dc8ef425 Rename variable to revertedUser
See https://en.wiktionary.org/wiki/victim

"Reverted user" is more descriptive in any case.

Bug: T254646
Change-Id: I70964850e63cdd832b2cc1799161c480f283d08c
2020-07-21 13:15:09 +02:00
Kosta Harlan efecfc07dc Hooks: Use new style hook registration to allow for DI
Implement RecentChange_saveHook interface and pass Config via hook handler
declaration in extension.json.

Change-Id: I2bc5950eb6fc066b2f2a83ea84b700d02b075de9
2020-07-03 04:06:58 +00:00
jenkins-bot d891751f11 Merge "Don't make unchecked method call on object that might be null" 2020-07-01 16:07:53 +00:00
jenkins-bot a2c6b21925 Merge "Update hooks to use PageSaveComplete" 2020-06-30 10:40:51 +00:00
Umherirrender 3c53d6acb9 phpcs: Break long lines
Use the codesniffer default of length = 120

Change-Id: Ifbfd56b20432e54805d3a9bce22cda888c1fc74d
2020-06-27 12:05:03 +02:00
DannyS712 28a5eafe8c Update hooks to use PageSaveComplete
Extension requires MW 1.35+, always available

Bug: T250566
Change-Id: I1131a50f03002337d6b6eac18fdcb6adaaa896ce
2020-06-26 15:59:04 +00:00
Ammar Abdulhamid 2a8b694ae9 Don't make unchecked method call on object that might be null
The final iteration of Ie41331f made it clear that ::getTarget()
method of the special page can be null other than User object.
Since we know this we should not make unchecked method call on it.

Bug: T251687
Change-Id: Ib36a6c947b58780171cf5e7343e79d8724414b83
2020-06-25 11:57:05 +01:00
jenkins-bot 17b57a6f37 Merge "Echo: Add gender support for Mute user label" 2020-06-25 04:32:47 +00:00
Ammar Abdulhamid d029f18570 Echo: Add gender support for Mute user label
Bug: T251687
Depends-On: Ie41331fe37ba08dba343f2b229d2374c0443a074
Change-Id: I563f3f3df84cc12a4256feb158f2e1ccf7c69aad
2020-06-18 21:46:03 +01:00
jenkins-bot 8fe5e47b76 Merge "Push: Add additional job params for logging" 2020-06-18 10:55:37 +00:00
Michael Holloway a2412732f6 Push: Add additional job params for logging
Adds additional job parameters to help diagnose the apparent issue of
jobs being performed twice on Beta.

Bug: T255068
Change-Id: Ib257a24056539487e1110fe286fa4535c3fec94a
2020-06-17 17:58:21 -04:00
James D. Forrester a1fb5d5d75 Add ten millionth edit thank you notification, per demand on Facebook
Change-Id: I26a0dd0954f7f3f61014cde371fa0c46c4db78cb
2020-06-17 19:39:39 +01:00
jenkins-bot 12090e6b0c Merge "Push: Check that the event type is enabled before scheduling job" 2020-06-15 11:48:06 +00:00
jenkins-bot 33091d5c74 Merge "Parse messages in string context" 2020-06-15 01:19:01 +00:00
Michael Holloway 07c8c0afcf Push: Check that the event type is enabled before scheduling job
It is the notifier implementation's responsibility to check the user's
notification preferences before sending a notification. This adds the
check.

Change-Id: I4b7fd7ea444f5a6db6d79fadb48a440d4fdf0ac9
2020-06-12 16:30:29 -04:00
Paladox 374aeb5fa9 Increase "euw_wiki" VARCHAR length from 30 to 64
This is the same fix that has been done to Flow.

Database names are limited to 63 per [1], so by upping the limit
we allow longer db names (e.g db names longer than 30 characters).

[1] https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-limitations-database-objects.html

Change-Id: I0d26a77c1bb49719eebc6beead4d79a27fcd3826
2020-06-11 17:23:19 +00:00
jenkins-bot c82226835b Merge "s/slave/replica/" 2020-06-11 01:01:49 +00:00
Michael Holloway 657e914513 Push: Bail out of notification job early if no subscriptions found
Change-Id: Ica8e5c0496171dba4315c27072c2d865eb747e78
2020-06-10 15:38:23 -04:00
Gergő Tisza 153db72ec4 Ensure an array is passed to ApiEchoMute::lookupIds()
The nicer approach would be setting the parameter default to [],
but that breaks ApiSandbox.

Bug: T254699
Change-Id: I6c553e27248ff7d6c696f116cb34eb238dade440
2020-06-10 13:47:05 +00:00
jenkins-bot ea200ace05 Merge "Remove overbroad DB error catching in ApiEchoPushSubscriptionsCreate" 2020-06-10 11:52:35 +00:00
Michael Holloway c9a826190d Remove overbroad DB error catching in ApiEchoPushSubscriptionsCreate
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
2020-06-09 23:48:12 -04:00
jenkins-bot 2a38f60ab8 Merge "Push: Submit requests to configured service endpoint" 2020-06-09 17:08:31 +00:00
Reedy aa702c1471 s/slave/replica/
Bug: T254646
Change-Id: I4de3985fd8568ce07919623efe2981bc0b6c54e5
2020-06-09 02:09:44 +01:00
DannyS712 9564e1ae50 Docs: Use replica instead of slave
Bug: T254646
Change-Id: I06387e33c5207ea59db34dba3b482893ff103288
2020-06-08 23:49:00 +00:00
Michael Holloway 1d31fd753a Push: Submit requests to configured service endpoint
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
2020-06-08 13:37:24 +00:00
Michael Holloway a5bcc65504 Fix push subscription retrieval
Updates the push subscription query to retrieve a provider string rather
than only its numeric internal ID.

Change-Id: I910173409e48e8b6a6739d3122165c40b0d52b7f
2020-06-08 13:58:42 +02:00
Umherirrender 2fe223e45c Pass function name to database functions
Useful for logging

Change-Id: I95d466224ff984653051990b540f29e243915e3f
2020-06-07 03:35:53 +02:00
Umherirrender 0b850dd88d Parse messages in string context
Change-Id: I62f0da3aaa0fd1467043aeb0e0dc3482f6b6600f
2020-06-06 21:28:08 +02:00
jenkins-bot 51ddc6f5db Merge "Parse messages in string context" 2020-06-04 22:01:41 +00:00
Kosta Harlan fb21b0abef Muted pages: Adjust config to not show missing titles
Bug: T46787
Change-Id: Ibb760615670ce36d198627b1628ee311b6fcb628
2020-06-03 12:49:26 +02:00
Umherirrender b19d4fd63b Parse messages in string context
Change-Id: I456558cb50bfe2398e24a7e9e65e939a0f936b77
2020-06-02 21:08:02 +00:00
jenkins-bot a9391e1035 Merge "Add push notifier" 2020-06-02 18:21:46 +00:00
jenkins-bot de09ddd4d9 Merge "Add push subscription management" 2020-06-02 18:21:42 +00:00
Michael Holloway ce7a46f7ed Add push notifier
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
2020-06-02 13:40:04 -04:00
Michael Holloway a3674974f1 Add push subscription management
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
2020-06-02 13:40:00 -04:00
Umherirrender 24ab1eb35c build: Bump phan to 0.10.2, remove taint-check
Change-Id: I27fe6a6d248a25e70f4b18f36cf75736ef949bc5
2020-05-31 16:57:07 +02:00
DannyS712 37cde0b9f2 UserClearNewTalkNotification: Only require a UserIdentity
Bug: T253435
Change-Id: I5e0d7a6300dfd6acda754e6334a6e3f58900d753
2020-05-29 08:40:47 +00:00
Roan Kattouw 28f432b150
Add dynamic secondary action to mute/unmute page-linked notifications
Also adds an API module for muting and unmuting pages (and users).

Bug: T46787
Bug: T115264
Change-Id: Icf4e4bfa9fd7fa27b4c40892e3d5ce000eb22d5a
2020-05-27 15:20:08 +02:00
Tim Starling 5252624729 Use HttpRequestFactory::createMultiClient()
Use the globally configured request timeout instead of MultiHttpClient's
hard-coded default. This means that the request timeout for
ForeignWikiRequest will typically be reduced from 900s to 25s.

Bug: T245170
Depends-On: I8252f6c854b98059f4916d5460ea71cf4b580149
Change-Id: I1c3d96720709253ad15bb8528cdd132571de2e4e
2020-05-21 14:23:28 +10:00
Clara Andrew-Wani 6dd0f21968 Use new TalkPageNotificationManager
Bug: T239640
Change-Id: Iba015bf246250fc144022d92b88eb00882dd1d3a
2020-05-15 12:58:14 -04:00
jenkins-bot 304f82c314 Merge "Add page linked event title muted list" 2020-05-12 21:08:47 +00:00
jenkins-bot c4faa9a99d Merge "Pass a user to EchoEvent::create" 2020-05-06 16:22:19 +00:00
DannyS712 868fb32c2e Pass a user to EchoEvent::create
Followup to 84a0d9ab57

Change-Id: I5a671e4cf5aa0d18b7e7bb59b57e410a91d462ab
2020-05-06 15:59:16 +00:00
Kosta Harlan 1560528dc7 Add page linked event title muted list
* 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
2020-05-06 12:38:55 +02:00
jenkins-bot 4ff2b21819 Merge "Replace use of ArticleRollbackComplete hook with RollbackComplete" 2020-05-06 00:16:45 +00:00
DannyS712 84a0d9ab57 Replace use of ArticleRollbackComplete hook with RollbackComplete
Extension requires MW 1.35+, so the hook is always available

Bug: T250543
Change-Id: I65a4e64cac05193e57b79be4afc3584e04007b5f
2020-05-05 22:44:40 +00:00
Tim Starling 41d53fde50 Don't put a whole User object in extra[mentioned-users]
DiscussionParser::getUserMentions() returns mentions in an array of the
form [ID => ID]. UserLocator says "we shouldn't receive User instances,
but allow it for backward compatability". But
DiscussionParser::generateEventsForRevision() was putting User objects
into the extra when there is a mention in the edit summary.

I noticed this when I accidentally made User objects be unserializable
in a core patch.

So, I made generateEventsForRevision() generate mention arrays in the
same ID=>ID format as getUserMentions().

Change-Id: I7c6d25950c8887b50426863c7b0a2d5d007559dd
2020-05-05 14:41:49 +10:00
Edward Chernenko 87053b91a6 Be compatible with third-party extensions that use NewMessagesAlert
1. Preamble:
Currently Extension:Echo unconditionally suppresses NewMessagesAlert,
because "You have new messages" is replaced by Echo notification.

2. Problem:
Some third-party extensions (such as Extension:Moderation) can use
GetNewMessagesAlert hook to inject their own notification, which must
not be suppressed.
By returning "false" from GetNewMessagesAlert hook, Echo stops those
third-party extensions from showing their notifications too.

3. Solution:
Allow those third-party extension to tell Echo "don't suppress this"
by returning false from the hook EchoCanAbortNewMessagesAlert.
This change has no impact on situations when no such third-party
extensions are installed.

4. How it was handled before this change:
Old solution for those extensions was to remove the hook of Echo from
$wgHooks, which was a dirty hack and is not compatible with T240307.

Change-Id: I433e30c5f639b5f20838804e8fa7c94a4bcf5349
2020-04-21 10:12:51 +03:00
DannyS712 55b018cdd4 Use LinksUpdate::getRevisionRecord
Bug: T249397
Change-Id: I335e12fc2f57a9ca07f985482eb4c339933ef13f
2020-04-08 02:31:43 +00:00
jenkins-bot 01c00b670a Merge "Use MediaWikiServices::getAuthManager" 2020-04-06 09:37:49 +00:00
Reedy 2661c3a787 Add getter for EventPresentationModel::$distributionType
There are cases where we want to vary on $distributionType what is sent.
If it's an email (for example), we might want more information and
context which is unneeded via the web notification.

Bug: T249408
Change-Id: I68cedfa8389e1d935b02ca7475bf42262005d2bc
2020-04-05 19:00:16 +00:00
Umherirrender 4337586f4a Use MediaWikiServices::getAuthManager
This required MediaWiki 1.35

Change-Id: I91de51208be72ad0eebc15c3d74069360014085e
2020-04-04 16:59:12 +02:00
jenkins-bot 92e72e9bad Merge "Replace deprecated User::isAllowed with PermissionManager" 2020-03-24 21:00:09 +00:00
DannyS712 1d8170a540 Use lowercase for primitive type 'string'
Change-Id: I7e4a3a198b973cf9037b283253c1e2dda6e8b873
2020-03-20 15:37:50 +00:00
Ammar Abdulhamid ad8340ea59 Replace deprecated User::isAllowed with PermissionManager
Bug: T220191
Change-Id: I321a1d67a9272dfb305d76589c6371176f1afc16
2020-03-14 19:14:37 +00:00
Umherirrender a933412ea5 Use MediaWikiServices::getMessageCache
This required MediaWiki 1.34 (already set in extension.json)

Change-Id: Ib9f9fe6581c3019fa32dff53acf33edb4266e44d
2020-03-14 14:04:32 +01:00
DannyS712 ee8118da41 Don't call mediawikiservices::getMainWANObjectCache if not needed
Change-Id: Iafbd3dfd0dfaec26c2f2b0b28b1b0dfecffd2a27
2020-03-08 10:00:28 +00:00
DannyS712 72f30649d5 Pass a user when creating a new ParserOptions
Bug: T246861
Change-Id: Ie6b6504d3b78a33ecb89a5c431bc225622d715c2
2020-03-04 21:53:33 +00:00
jenkins-bot bca3707961 Merge "Fix IDatabase::upsert() call with bad unique key parameters" 2020-02-19 22:11:07 +00:00
jenkins-bot f281b221eb Merge "build: Updating composer dependencies" 2020-02-19 21:33:02 +00:00
Aaron Schulz 0bc5117dbb Fix IDatabase::upsert() call with bad unique key parameters
Change-Id: I13c484991166eba7b90eef13c324834a39db63a9
2020-02-19 13:20:40 -08:00
libraryupgrader cbc50bd4fe build: Updating composer dependencies
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.2

Change-Id: I384e3624fadebd736a3ea465df79df6bf9dd5a74
2020-02-19 20:20:29 +00:00
Kosta Harlan 9fd66198ee Fix web installer/updater for Echo
Loosen check for $wgEchoCluster, because when this hook fires $wgEchoCluster is
set to null (even though extension.json sets it to false as the default).

Bug: T165317
Change-Id: If7f2677a20407612de17a38ac2c6da444377d7b4
2020-02-11 12:30:17 +01:00
Umherirrender af3fa8a78b Enable MediaWiki.Usage.ForbiddenFunctions.isset and make pass
Change-Id: I4fe47b3cc4ecd124809a58306b6abb0ea202d56a
2020-02-09 11:58:49 +01:00
Roan Kattouw 0ff7678377 Document ext.echo.unseen counters
There are two counters (ext.echo.unseen and ext.echo.unseen.click) that
are incremented in two different places. It's hard to see how they're
connected unless you know where to look.

Add comments to each of these counters pointing to the other one and
explaining what they're for.

Change-Id: I0699cba85bf797e4f7ef42cc6a7a996aa35510f0
2020-01-16 17:46:08 -08:00
jenkins-bot 5fcc43d615 Merge "build: Updating mediawiki/mediawiki-codesniffer to 29.0.0" 2020-01-14 15:52:16 +00:00
libraryupgrader ff43e1ecf2 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
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
2020-01-14 05:09:44 +00:00
Roan Kattouw b2f816d0af Use GET rather than POST for action=markseen
This seems strange, because markseen sounds like a write action, but it
writes to the seentime cache rather than the database. For multi-DC
support, we need writes to the seentime cache to happen in the local
data center, and the easiest way to do that is to make it a GET request
rather than a POST request.

It would be nice if marking as seen could be consolidated into the GET
request for fetching notifications, but I didn't do that because the
code for those fetches is pretty complicated, and some fetches (like
polling) should not mark as seen.

Bug: T222851
Change-Id: If4c504a9dc562b1d4e626e155fba8ebb5cdb0579
2020-01-10 16:12:18 -08:00
Matěj Suchánek e16ff3a939 Remove dead code from EchoHooks.php
Change-Id: Ie1ff4977a61b9c0350b2c8891ce26b6fa8cf49e5
2020-01-05 14:38:26 +00:00
Matěj Suchánek d4a18d15b7 Remove redundant check in MentionPresentationModel.php
Pages in user talk namespace are always talk pages, so
no need to check for this.

Change-Id: Ideac85cfaddb65f4758fe00be028dd6d067e0d72
2020-01-02 15:42:23 +00:00
Matěj Suchánek 2d6472ff61 Remove unused variable
Change-Id: I43b83972fe818f236c10522bdaaecbb2def88903
2020-01-02 10:49:35 +01:00
jenkins-bot 30ed6adb92 Merge "build: Updating mediawiki/mediawiki-phan-config to 0.9.0" 2020-01-02 08:59:53 +00:00
Umherirrender 317246762c Removed comment out debug code from EchoDiscussionParser
Change-Id: I0f5823253e7dbad6aabcc85f3f1e0c2196874f66
2019-12-29 16:08:15 +01:00
libraryupgrader ef3d2b886d build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: I03333636654eff80d4fe7fa543ac9e6c321af891
2019-12-29 11:59:32 +00:00
Thiemo Kreuz (WMDE) 65700e6c0e Revert "Make method parseNonEditWikitext public"
This reverts commit b4fdb685cb.

Change-Id: I33abe899f34903cfcc24c7a4f45e70aaab3f0abb
2019-12-28 20:16:38 +00:00
Paladox b4fdb685cb Make method parseNonEditWikitext public
It's used by the Comments extension.

Change-Id: If69b1706067a0c80420e427a453da965f226aa75
2019-12-23 01:54:53 +00:00
Umherirrender 4c991af59f Use WebRequest::getInt for limit parameter
This avoids that the default value is casted to string
and than back to int

Change-Id: I66ef8bc3a8e89b43aa5eff79bc371659e86af174
2019-12-13 22:29:07 +01:00
jenkins-bot 8b6efb51bb Merge "Add preference to not receive digests about read notifications" 2019-12-12 11:14:30 +00:00
Ben Houghton 9ae45afdfd Add preference to not receive digests about read notifications
Allows users to opt out of receiving daily or weekly digests containing notifications
they have already marked as read on the web.

Bug: T169386
Change-Id: Ib47248678f88095492fb6896530be5a9f5bb43ca
2019-12-12 06:30:13 +00:00
Pppery db78c1552e Add support for watchlist events
Bug: T203941
Change-Id: I9bcd13cb0a547393696dde0e977b7761cc1fea68
2019-12-11 16:39:02 -05:00
Roan Kattouw d85252b97d DiscussionParser: Fix type hint fatal from getUserLinks()
Instead of returning false when no links in the user namespace are
found, return an empty array. They're both falsey, but this way we don't
break the type hint in generateMentionEvents(), which is the only thing
that getUserLinks() is used for anyway.

Bug: T239275
Change-Id: I93b320be07cfdae68c5e296b2caa62ea4fae5ff2
2019-11-26 17:57:16 -08:00
jenkins-bot 4b8eb663df Merge "build: Updating mediawiki/mediawiki-phan-config to 0.8.0" 2019-11-25 21:01:26 +00:00
Max Semenik 36af0f2cf1 Stop passing objects by reference
Bug: T193950
Change-Id: Ie8a2302137c5b5fc67862031ffe244c50769fa1f
2019-11-18 23:23:22 -08:00
Umherirrender f62ab66363 build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Change-Id: I93844dc6fae8a3dca3ced591d43caa2f994ba2f1
2019-11-18 20:03:13 +01:00
Thiemo Kreuz 048a9e84c1 Remove duplicate private property from NotificationDeleteJob
Every job class does store it's properties in the $this->prop array
anyway.

Change-Id: Ib1c810ee367a2771e19fac25056c9e7bef22cb01
2019-10-31 18:18:08 +00:00
jenkins-bot c8eea3eb35 Merge "Add strict "array" type hints to code expecting arrays" 2019-10-28 08:48:51 +00:00
jenkins-bot 6e48f16af6 Merge "Use READ_LATEST constant and fix a soft type hint" 2019-10-24 18:37:13 +00:00
Thiemo Kreuz 0efef4faf3 Add strict "array" type hints to code expecting arrays
I found candidates for this by looking for parameters names that end
with a plural "s".

Change-Id: I61c706eb4dfbdadceb0129afd724e6ce1eb4f4a8
2019-10-24 15:18:58 +00:00
Thiemo Kreuz d79dd00e01 Use READ_LATEST constant and fix a soft type hint
Change-Id: I2123c5efe01a5b42daeec9c7b0eefce089864657
2019-10-23 12:45:51 +02:00
Thiemo Kreuz 229c3d0fdd Remove non helpful (auto-generated) comments
None of these comments explains anything that wouldn't be obvious
from the code itself.

Change-Id: Ibcf50d401999ae76f315df2d2d27097a39f41bbd
2019-10-23 12:31:35 +02:00
Marko Obrovac 6ae3efc1c3 SeenTime: Do not set the cache key to Unix epoch
Now that seen times are TTL'ed, there is little sense/incentive to set
them in the cache to the default value, since we assume the default
value if they're not in cache (which is being set here). Therefore,
setting them only increases the cache size without any gains.

Bug: T222851
Change-Id: I78a0045e4a53653196114da81c2d60328e78c269
2019-10-18 14:23:28 +02:00
Roan Kattouw ff165c0003 Make EchoSeenTime cache entries expire after 1 year
These entries weren't TTLed at all, and so we had millions of records
for inactive users that were being stored forever. If a user doesn't
view their notifications for a year, it's OK for their notifications
badge to go back to the unseen state until they click it.

(The fallback behavior on a cache miss is to act as if the seentime is
the UNIX epoch, which means that any unread notification they have is
more recent than it, and is considered unseen.)

Bug: T222851
Change-Id: I99230d2351b40751a3f2f5123c5f38693120259e
2019-10-18 12:05:52 +00:00
Roan Kattouw 79ee7582f2 Make EchoSeenTime cache type configurable
Defaults to MainStash, but can be configured to use a different cache
backend by setting $wgEchoSeenTimeCacheType to a string that keys into
$wgObjectCaches.

Bug: T222851
Change-Id: Ifb935cc8be4618f7794ee79a234fc66d5cc5728a
2019-10-18 11:32:03 +00:00
Kosta Harlan ccab496734 Remove PhanTypeMismatchArgument from call to appendContent
Breaking in
https://integration.wikimedia.org/ci/job/mwext-php72-phan-docker/16324/console

Change-Id: I9a6b06158d9083317aea46510c0c47980a25e50a
2019-10-16 10:53:12 +02:00
James D. Forrester abaff73626 build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: Ib66b0ad1b3929bf7e49eb40a3d5463b0d8b2280b
2019-10-10 09:29:24 +00:00
jdlrobson d3c0494a17 Dormant mobile notifications overlay lives in Echo
This code will be enabled when Iba1d7863171268066bf7597182c57a0a2041497f
relinquishes the responsibility for rendering the Echo notification badge
and wiring up of the related JS.

It makes 3 assumptions:
1) Minerva will expose a VERSION property on the skins.minerva.scripts module
to tell Echo it can begin control of the functionality
2) A new hook `SkinMinervaReplaceNotificationsBadge` will run on the server side
allowing Echo extension to render the Notifications badge in Minerva.
3) A new client side hook (echo.mobile) will fire whenever the Echo dialog is opened or
closed.

All code relating to Echo inside MobileFrontend and Minerva is
moved here.
CSS for the modules is kept in Minerva as skinStyles

This code remains dormant until Iba1d7863171268066bf7597182c57a0a2041497f lands.
It pre-registers a "to-be-created" hook SkinMinervaReplaceNotificationsBadge that
substitutes the Minerva badge.

It also watches the export value of skins.minerva.scripts for a VERSION value - when
this appears it will take the signal that it should manage the frontend code.

In the new system the mobile specific code is limited to the mobile version of
Minerva. The desktop version of Echo loads on Minerva desktop - presenting an
opportunity in future to consolidate both implementations to use the same component.
The mobile version of Vector and Timeless for example will load the mobile overlay
(with existing styling issues that we don't need to worry about right now given
we don't officially support skins other than Minerva as mobile)

Testers:
* Check require( 'ext.echo.mobile' )(); inside initMobile
inside ext.echo.init does not fire until
Iba1d7863171268066bf7597182c57a0a2041497f is checked out.

Depends-On:  I1a66939d2b596094b419de40b370e79f09c85581
Bug: T221007
Change-Id: I09c27a084100b223662f84de6cbe01bebe1fe774
2019-10-09 12:36:11 -07:00
Roan Kattouw 83f8949dc5 Stop exporting wgWikiId, use wgWikiID from core
Update usages of the variable for the capitalization difference.

Depends-On: I4d289267991f1f9a8e0710ec6ee5a2131306c510
Change-Id: Ie49e898b33765aa0723501be8c0c30622e7cbd2f
2019-09-25 18:14:40 +00:00
Kosta Harlan 15d36ccae5 Remove global usage in UserNotificationGateway
As noted in Ic22075bb5e, UserNotificationGatewayTest relies on the presence of
globals. When Ic22075bb5e is merged, UserNotificationGatewayTest will fail in
CI. This patch injects the configuration object into UserNotificationGateway.

Change-Id: I9c15a588a76a41a3ebfb59dac7f0761f756008ff
2019-08-30 22:58:41 +02:00
DannyS712 0b237983b8 Use Special:MyLanguage in API help links
Bug: T231269
Change-Id: I76e1e257616d8e2a43bcbe9efadead71a09bb058
2019-08-27 06:14:51 +00:00
jenkins-bot 358bdad695 Merge "Define preference for poll updates" 2019-08-06 23:14:49 +00:00
shivanshbindal9 2528e3394f Define preference for poll updates
New preference added so that user can set
* Displaying (n) total unread count in the title
* Displaying notification snippet for incoming notification

Bug: T229732
Change-Id: I35eb68dedf1e087b4668bfec404935f1244b3d0b
2019-08-06 19:42:49 +05:30
Matěj Suchánek 19c55cd7ca Improve EchoPresentationModelSection
Add documentation and recommendation to one public method
and make getTitleWithSection safer.

Change-Id: I9c17032a80e736751d21c16ca0178b54c498bded
2019-08-02 12:24:59 +02:00
Roan Kattouw a3bfd725ea Bundle logger-related config vars with ext.echo.logger module
There's no real reason for these to be in MakeGlobalVariablesScript
because they don't really depend on the request context: they were being
omitted if the user was not logged in, but we can just check the user's
logged-in status in JS instead.

Bug: T221151
Change-Id: I2df6d7e061545d342bc3068dccd5ce2f6e85fe78
2019-07-23 21:48:42 +00:00
Roan Kattouw cf760b8d84 Use Config parameter instead of deprecated ResourceLoaderContext::getConfig()
Depends-On: Ia4666914e9b07f298ee5ae30ae8c70a3e83b0910
Change-Id: I4578bfc93d8a4615d54d99340ed9cceaa8bb76da
2019-07-18 15:30:41 -07:00
Roan Kattouw d378e4e3b9 Use packageFiles instead of startup module for config vars
Remove wgEchoMaxNotificationCount and wgEchoPollForUpdates from the
startup module and put them in the ext.echo.init module.

Change-Id: I03f9a3953aa97ead1a29c13a992a02404a6d0b68
2019-07-18 15:29:27 -07:00
Dayllan Maza b3df45dc34 Add option to mute/unmute notifications on Special:Mute
The hook (SpecialMuteModifyFormFields) is used to append
the option to mute/unmute echo notifications from a specified user.

Special:Mute handles posting and saving the fields, the only
requirement is that the field name is the same as the property
that wants to be modified, in this case 'echo-notifications-blacklist'

Bug: T220163
Depends-On: I2b3eee0802cb086091f35ecce13ae77a8e7d518d
Change-Id: I77b3ccfdce9b501eb8ecd58c0d7bbecb78029a7e
2019-07-18 15:47:24 +00:00
Roan Kattouw e6e7541531 MentionInSummaryPresentationModel: Fix PHP error
RevisionRecord::getComment() can return null. When it does, accessing
->text on it fails.

Bug: T226681
Change-Id: I069cd5d5bef51a3e2b8f4e7b50d478cf47f65e00
2019-07-15 17:06:15 -07:00
libraryupgrader 4bf8a6736a build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 24.0.0 → 26.0.0

npm:
* set-value: 2.0.0 → 2.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* union-value: 1.0.0 → 1.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* mixin-deep: 1.3.1 → 1.3.2
  * https://npmjs.com/advisories/1013
  * CVE-2019-10746

Change-Id: I6d3efdf65c207b98447565e2df6f0698aaa8ea6b
2019-07-14 10:57:49 +00:00
James D. Forrester 1b2c8eebfc build: Upgrade phan-taint-check-plugin from 1.5.x to 2.0.1
Bonus: unset loop variable after mutable foreach.

Change-Id: I652fe65e4691a92175569a72f081f4553c4459c5
2019-07-11 13:40:37 +00:00
jenkins-bot a32d18d73e Merge "Make Notification count update without page reload" 2019-06-18 23:39:41 +00:00
shivanshbindal9 43bff91c68 Make Notification count update without page reload
* MVC is used to change the count of notifications on header icons.
* The Widgets are loaded after 60secs or icon click, whichever occurs first.

Bug: T219222
Change-Id: I2d034a76d5c3abe55894dd1dd10e28713344c5bb
2019-06-18 04:49:59 +05:30
Derick Alangi f402ecd31f Echo: Fix case mismatch for function/method calls
PHP doesn't care much about the name (in terms of case sensitivity)
but I think we should make sure the names of the method should be as
they're in their definition.

Change-Id: I6e38d8be64efaec4200471f2d3007275d7ddecec
2019-06-11 22:46:24 +01:00
jenkins-bot 21354c66a2 Merge "Remove badgeicon module, use OOUI icon instead." 2019-06-05 19:08:33 +00:00
shivanshbindal9 c86a1a5cf3 Remove badgeicon module, use OOUI icon instead.
Now that OOUI's "alerts" icon pack includes all the icons we need, we can use it and get rid of the badgeicons module.

Bug: T139779
Change-Id: I8218530ed2cdd2d81c1fc24509f36ea2b6742bd9
2019-06-05 12:29:17 +05:30
Stephane Bisson 1ebb8e3daa Don't add CommentStoreComment as plaintext params
Follow-up Icfc8516 and I3d997f9 (migrating from deprecated Revision
to RevisionRecord)

When generating 'edit-user-talk' events, if we don't have the section-text,
we use the edit summary instead.

Revision->getComment() returns a string but RevisionRecord->getComment()
returns a CommentStoreComment. As a result of the migration, an instance
of CommentStoreComment was put into the event 'extra_data' and later
added as a plain text params during notification presentation.

This patch proposes to
1) Make sure to add the comment's TEXT to the event
2) Test that the 'section-text' is a string before using it
   as a message parameter. This will cause faulty notifications to
   render without a body instead of erroring out. We could write a
   maintenance script to fix those notifications but I don't
   think it's worth it.

Bug: T223741
Change-Id: Ie3a1c59a43b0981ec42fc77e7ebb0e8bd132dbe2
2019-05-21 11:44:54 -04:00
Hashar e3ae1a62d0 Revert "Make phan ignore JsonSerializable redefinition"
This reverts commit 13956265c1.

The Wikimedia CI jobs running phan were installing mediawiki development
dependencies which might overlap with the dependencies from the
extension. Ultimately phan failed with:

includes/RemoteSchema.php:9
PhanRedefinedInheritedInterface
\RemoteSchema inherits abstract Interface \JsonSerializable declared at
internal:0 which is also declared at
../../vendor/jakub-onderka/php-parallel-lint/src/JsonSerializable.php:4.
This may lead to confusing errors.

If7171a6d46473b0bb05e3adaeb40229e7881c2b6 adjusts the CI configuration
to no more install MediaWiki core development dependencies and solely
relies on mediawiki/vendor.git. That prevents the duplicate interface
definition.

Bug: T223397
Depends-On: If7171a6d46473b0bb05e3adaeb40229e7881c2b6
Change-Id: I794fbffe59104f138802bc6ded1a9d9a58ba9437
2019-05-21 10:34:28 +02:00
James D. Forrester 980e67d338 build: Upgrade mediawiki/mediawiki-phan-config from 0.5.0 to 0.6.0 and make pass
Change-Id: Ifc83427ccdcfc34d33a667ffde5e0cec98a0a609
2019-05-19 13:33:12 +02:00
Roan Kattouw b31119ea19 Remove unused method EchoEvent::isDismissable()
Change-Id: Ibea0c85cf9dd13cc2b6f22d27e8e3e0b927256c0
2019-05-18 17:37:54 +02:00
Roan Kattouw 05499e0446 Fix fatal "Object of class CommentStoreComment could not be converted to string"
Bug: T221163
Follows-Up: Icfc85167a636bef95daab236ab80113c1a3cf41b
Change-Id: I92811ae9e383f431ef939b004c7d10126e051bbf
2019-05-09 21:35:03 +00:00
jenkins-bot 74f7784cdf Merge "Migrate DiscussionParser::getEditExcerpt() to accept only RevisionRecord" 2019-05-09 21:24:10 +00:00
jenkins-bot c5ed6315cc Merge "Remove usage of deprecated Revision class in Echo" 2019-05-09 20:56:17 +00:00
Derick Alangi 76544df40a Migrate DiscussionParser::getEditExcerpt() to accept only RevisionRecord
Follow up on Icfc85167a636bef95daab2.

Bug: T221163
Depends-On: I31d819f4453032da8deb117254b954fba058e0a3
Change-Id: I3d997f9e8d4bd1566ec6fd8fe2d33be5161458b3
2019-05-09 20:36:05 +00:00
Thiemo Kreuz be5919f623 Make use of the PHP 7 ?? operator where it makes sense
To my knowledge in all the places I'm touching in this patch the new
code is functionally identical to the old one.

Change-Id: I0ffa96d2f9cb9bf932f68b689244051c96c17ad9
2019-05-09 15:57:16 +00:00
Derick Alangi 8e5aa13a73 Remove usage of deprecated Revision class in Echo
Class Revision is deprecated and in this patch, replaces
usage with appropriate classes; RevisionRecord, RevisionStore,
etc.

Bug: T221163
Change-Id: Icfc85167a636bef95daab236ab80113c1a3cf41b
2019-05-08 19:50:58 +01:00
Stephane Bisson f5f59a503b Use wikiId both server and client side
When creating the various notification sources,
the server was indexing them with wfWikiID() but
the client was using wgDBname to find which one
is local and which are remote. On some wikis,
like TWN, wfWikiID() includes a db suffix so
the JS app on Special:Notifications is failing to
find the local source and errors.

Bug: T167336
Change-Id: Id60f723b615fb7db54a6f17b1c1be20dfe98e36c
2019-05-08 09:03:28 -04:00
Derick Alangi c4890ca86f Remove usage of deprecated database access code from Echo
Bug: T221164
Change-Id: Ib7cfe384f4104dbaeed5ba6659e81555eb810f97
2019-05-07 20:46:07 +00:00
Stephane Bisson 13956265c1 Make phan ignore JsonSerializable redefinition
Change-Id: I1cffc88a3f4ea4290892c0624a6f32e852cde1dd
2019-05-07 16:21:22 -04:00
jenkins-bot b8aaf37e4a Merge "Proactively delete echo_event rows when they become orphaned" 2019-05-02 19:45:49 +00:00
Roan Kattouw 0e4f4ffad9 Proactively delete echo_event rows when they become orphaned
When deleting echo_notification or echo_email_batch rows, also delete
the corresponding echo_event rows if no other echo_notification rows
or echo_email_batch rows refer to them.

Bug: T221262
Change-Id: I416ff107bd000a0cfac102408c993f8bec2d0286
2019-05-01 11:23:27 -07:00
Roan Kattouw 95172c2c7e Remove per-type notify-type-availability (make it category-only)
Bug: T221264
Depends-On: I74f660e88d18d5a27cc1e74f39316bb27aec1cbb
Change-Id: I12cc0312dbfd9a6923b64117e001841a7bfaaf17
2019-04-26 17:36:10 -07:00
jenkins-bot 0174b81a3a Merge "Remove all traces of cross-wiki beta feature" 2019-04-19 23:25:04 +00:00
Stephane Bisson 2fb8db3bca Remove all traces of cross-wiki beta feature
Bug: T221260
Change-Id: I447b5220220fdad68a55629ba5a532db720ca8da
2019-04-17 22:18:13 -07:00
Stephane Bisson 1017054b88 Cleanup transition flags
$wgEchoSectionTransition was introduced when we moved some notification
types between sections (alert, message).

$wgEchoBundleTransition was introduced when we made bundles dynamic
and expandable.

Both flags have been OFF for years and are not needed anymore.
This patch removes all traces of them.

Bug: T140710
Change-Id: I16a5d54b09e71997f80208db6f4fbdb040d03ab1
2019-04-17 22:07:14 -07:00
jenkins-bot 074ce90263 Merge "NotificationJob: make sure we retry to load the event from master" 2019-04-17 18:54:47 +00:00
Derick Alangi 7e5e63b1d5 Remove usage of deprecated cache code from Echo
Bug: T221165
Change-Id: Ib7512395b1cc4fd5e13a8d13bd966b1088f34374
2019-04-17 15:22:37 +01:00
jenkins-bot 9208a5b02e Merge "Revert "Email: embed icons as data uri"" 2019-04-17 01:13:02 +00:00
Sbisson a1aeebc5a6 Revert "Email: embed icons as data uri"
This reverts commit 7121b9c491.

Reason for revert: Data URIs don't work in gmail

Change-Id: I8f9a6a19ba32f1e078d61d1692a102912f5039a7
2019-04-17 00:30:17 +00:00
Stephane Bisson f361425a34 NotificationJob: make sure we retry to load the event from master
EventMapper->fetchById() has retry on master built-in but it doesn't
kick in in a Job because the load balancer is a new instance and doesn't
know about previous writes.

This change makes the job always read from master to make
sure the event is found. It is going to write to master
right after anyway.

Bug: T204894
Change-Id: I9a2873234f1dd5416e6c2bedeb904880d1f79562
2019-04-16 17:06:48 -07:00
Roan Kattouw f3c9a0a255 AttributeManager: Check notify type availability before notifying
It was sort of checked in an implicit and roundabout way, in the sense
that the preferences page checks this and forces the relevant
preferences to on or off. But this was difficult to discover, and it's
not clear if this works correctly when defaults change.

Instead, explicitly check whether the requested notify type is available
for the event's category. Also rewrite the entire method to use
array_filter().

Change-Id: I9502a42fc705b2e56ef5edab433f1804f2924359
2019-04-12 18:00:04 -07:00
Stephane Bisson 61a839315a Use echo_event.event_page_id to find events to moderate
When pages are deleted or undeleted, their associated
Echo notifications also need to be marked as deleted
or undeleted. This is done by looking up the
echo_target_page table.

With this change, echo_event.event_page_id is also included
in the search. This way, all the events that don't use
target pages are also moderated when needed.

Bug: T217452
Change-Id: I277fca68ce088ab564e76ed9dfb2134ab3be4c4a
2019-04-11 10:48:49 -04:00
jenkins-bot 9c3b122b83 Merge "Do not fail on unknown revids in mention-summary events" 2019-04-11 11:12:51 +00:00
Stephane Bisson 7121b9c491 Email: embed icons as data uri
When the location on disk of an icon is known,
load its content and turn it into a data uri
for the <img> tag.

Otherwise (when it's only configured with a url),
use the url in the <img> tag.

Bonus: the rasterized icons were a bit blurry
and they are now crisp.

Bug: T55479
Change-Id: I8b5d7f09d8181f22927b8d4712505212ea1a10b1
2019-04-10 13:33:50 -04:00
jenkins-bot 3dbfbfb670 Merge "Add phan" 2019-04-10 17:29:04 +00:00
Daimona Eaytoy e21e3b4a8d Add phan
Change-Id: I65ae6adc10941c05a2646e551b1baa829e4e8654
2019-04-10 18:51:59 +02:00
jenkins-bot 7d7531c0e5 Merge "Remove unused messages" 2019-04-10 03:58:36 +00:00
Roan Kattouw f0476b7009 Remove unused messages
Also clean up references to nonexistent messages in qqq.

Change-Id: I3811da1b1420318e5bf747f26244a4bb00d68cc5
2019-04-10 03:37:18 +00:00
jenkins-bot f0cb367140 Merge "Don't use {$this->type} in message keys where not needed" 2019-04-10 03:25:23 +00:00
jenkins-bot 22c08547a6 Merge "Add visible help link for Special:Notifications" 2019-04-09 15:32:14 +00:00
Shivanshbindal9 a09db3ea59 Add visible help link for Special:Notifications
Bug: T200184
Change-Id: Iaf321f88322e8a9686be62eb9b055c6544cf0ad6
2019-04-09 10:27:40 -04:00
Roan Kattouw 9832d2af8b Don't use {$this->type} in message keys where not needed
It makes the code less clear and makes message keys harder to grep for.

Change-Id: I0641e7cd0b8262d8b6548a06d505e19c1b5a1fb0
2019-04-05 17:33:28 -07:00
Stephane Bisson 754338fe48 Convert PresentationModelSection from trait to class
This trait was using private fields from its host classes
($this->event, $this->language). It created a weird coupling
situation where the host class uses the trait and the trait
uses the host class. Effectively a circular dependency.

Also, phan is complaining about it in
I65ae6adc10941c05a2646e551b1baa829e4e8654

Change-Id: Ib2796b7ca62ecd7ece19583d7ca83e4252a5d878
2019-04-05 16:57:48 -04:00
Roan Kattouw d002512f09 Pass viewing user as $3 to email subject messages (for GENDER)
Do this by default in EventPresentationModel so it automatically works
for all email subject messages.

Update messages to use this parameter. Also update email subject
messages that were trying to use parameters that didn't exist, and fix
message documentation that was completely wrong about what the
parameters were.

Also update translated messages to account for parameter shifts (in many
cases, these messages were using the wrong parameter or a nonexistent
one).

Bug: T219620
Change-Id: Ia420c4db13c95d91e1bfc4c7950942df5858379b
2019-04-04 14:58:43 -07:00
Umherirrender 04fda8aab6 Do not fail on unknown revids in mention-summary events
No revision, nothing to format

Bug: T219155
Change-Id: I701731b0eb3c825e98bb04896375e9f87b490564
2019-03-27 19:26:03 +01:00
Umherirrender 4b75dc8d0f Use ::class on \DatabaseUpdater::addPostDatabaseUpdateMaintenance
Change-Id: I2e3b12645818ca97ff991446cc5f4ad4c9c07e6e
2019-03-15 19:28:29 +01:00
jenkins-bot ad3c072d87 Merge "Use php null coalesce operator ??" 2019-03-12 21:07:20 +00:00
jenkins-bot 09bfec0781 Merge "Avoid use of func_get_args()" 2019-03-12 20:07:48 +00:00
Umherirrender c3d0760405 Use php null coalesce operator ??
Change-Id: Icb7d61b0b9040ee08caedef90b4dd2b65d403540
2019-03-12 21:04:00 +01:00
Kunal Mehta 0355c73c91 Avoid use of func_get_args()
Change-Id: Id55f26b3cf86af5ba628156a68e0c93bd5918b7a
2019-03-09 17:54:04 -08:00
Olena23 8421ce0121 Fix typo
Fixed typo occurd-occured

Bug: T201491
Change-Id: Icae706f162ed212daf4c800068de3932d2f8d567
2019-03-08 15:36:55 +02:00
Umherirrender a10978b7af Pass IContextSource to parent in NotificationPager
It is already called with a context in SpecialNotifications
Set context on SpecialNotificationsMarkRead and pass title to html form
to pass texts

Change-Id: I24eb85648580ac1a4df5e7587806bad57c141785
2019-03-07 17:57:34 +00:00
jenkins-bot f5559a72cc Merge "Remove notification_bundle_display_hash" 2019-03-06 19:59:25 +00:00
Roan Kattouw 91465ef753 Remove notification_bundle_display_hash
Also remove fetchNewestByUserBundleHash() because it's now unused,
and remove the echo_notification_user_hash_timestamp index which
existed specifically to support that function's DB query.

Bug: T143763
Change-Id: I74be8f156bc14d0e189d328953d17dc26cdb697b
2019-03-06 10:29:05 -08:00
jenkins-bot 08a9f9e9c4 Merge "Remove notification_bundle_base" 2019-03-06 14:05:23 +00:00
jenkins-bot 69ca0fac71 Merge "Migrate and remove event_page_namespace and event_page_title" 2019-03-06 14:00:26 +00:00
Derick Alangi 3971e32f1b Code improvements for includes/ **only** directory
This code improvements seeks to improve on code readability, consistency,
maintainability and efficiency.

Change-Id: I4f07886044e9a75824f9e7ddad039f3112b1c4a1
2019-03-05 18:58:52 +01:00
jenkins-bot b93e548d91 Merge "Fix off-by-one edit count for ThankYouEdit notification" 2019-03-05 01:58:46 +00:00
Stephane Bisson 408721a357 Fix off-by-one edit count for ThankYouEdit notification
Incrementing user edit count was moved to a deferred update in
I0d6d7ddd91bbb21995142808248d162e05696d47
That causes the notification to lag behind, and the thank you notification is
sent for your first edit on the second, you 10th on the 11th, etc.

This change simply assumes one more edit than the current count unless it is
running from the CLI (this is needed for the test to continue to work).

Since the update job is mergeable, it is possible that a certain value will
be skipped and the notification for it never sent. See task for moe details.

Bug: T209541
Change-Id: Iea61b0f525be25f63f50582933a16a79a52e141f
2019-03-04 20:39:22 -05:00
Roan Kattouw ae75a8118a Remove notification_bundle_base
No longer used in the new bundling system.
Also removes indexes that contain bundle_base.

Bug: T143763
Bug: T131415
Change-Id: Ibf94cdc471a11cb14995fee6a55af0d227b50aa5
2019-03-04 13:22:17 -08:00
Roan Kattouw b73522549d Migrate and remove event_page_namespace and event_page_title
By running updateEchoSchemaForSuppression.php as an updater.
The patch-*.sql files already existed, they were added
in 2013(!) by 34fbeaf8c but never applied.

Bug: T136427
Bug: T50059
Change-Id: Ied049681df4bab325f069c3a68cf704ee9a8f2c9
2019-03-04 13:12:52 -08:00
jenkins-bot a838836a23 Merge "Use explicit columns and avoid SELECT *" 2019-03-04 21:12:28 +00:00
jenkins-bot 8de5066b24 Merge "Convert caching to WANObjectCache" 2019-03-04 15:06:35 +00:00
Umherirrender 1b5308ba81 Use explicit columns and avoid SELECT *
Change-Id: Ibde033784aee5adc13fae6f1d395d9464f54fefd
2019-03-02 22:39:53 +01:00
Umherirrender 8ce0cc171d Fix UserMerge integration for use with table prefix
This fixes tests, because EchoHooks has "echo_event.*" which is invalid
with table prefixes, like done in unit tests
Added EchoEvent::selectFields() for future use and to replace more
SELECT *

Bug: T217487
Change-Id: I51cb46812431635d11780633dc7d807cd04f813d
2019-03-02 22:05:22 +01:00
Umherirrender 8da7e5b04a Pass string as field to IDatabase::selectField and ::selectRowCount
It is documented as string, because it can only select one field,
not a list of fields

Change-Id: Iad8ff691e642220359f45f97359aa624261af673
2019-03-02 17:29:29 +00:00
jenkins-bot 19cef58454 Merge "NotificationDeleteJob: Remove unused variable $targetMapper" 2019-03-02 03:43:50 +00:00
Roan Kattouw db6c1f076d NotificationDeleteJob: Remove unused variable $targetMapper
Change-Id: Iaf5e3ae53ae55820dca9c7b7d96506154af0f75d
2019-03-01 17:05:10 -08:00
Aaron Schulz bb0ca321df Convert caching to WANObjectCache
Change-Id: I6c0315aa6e24c573cf9a8410ff21471ed3da60d1
2019-02-28 21:56:38 -08:00
jenkins-bot c9b2770c8c Merge "Declare class properties in Formatter and WikiRequest" 2019-02-28 23:41:34 +00:00
Umherirrender 79b2611bbc Use local vars in LabelIconWidget
Change-Id: I037b02c7336d68f520e028a16df0edd0237458d8
2019-02-23 21:26:35 +01:00
Thiemo Kreuz 8fd66d4281 Make use of the …::class feature in production code
This codebase already used the …::class feature a lot. This is more
about making the code consistent and easier to refactor in the future.

Change-Id: If5b2456b825aae753ed97445160ec191c18df8e3
2019-02-20 19:13:54 +00:00
Thiemo Kreuz e649551e5e Simplify a few overly complex code snippets
* preg_match_all already returns the number of matches. We can just use
  this number instead of counting it.
* Checking for a strlen() of 0 is a little tooo expressive, because we
  don't really care about the actual length of the string.

Change-Id: I0537a7740e5d369b79364f24aecf71c4e8fa7db1
2019-02-19 20:39:26 +00:00
Umherirrender fdc2b42b2b Declare class properties in Formatter and WikiRequest
Change-Id: Iaf4c2f7bb75896d3daafbb445f7b5f6341543f8e
2019-02-18 19:25:56 +00:00
jenkins-bot 3fd6549ced Merge "Improve param docs and add @var to clarify types" 2019-02-17 01:29:48 +00:00
Matěj Suchánek cd4e510201 Fix undeclared var
Credit goes to Umherirrender who pointed this out.

Change-Id: I4d590b3574ea1310fa795cfd94a129e3046e6e3c
2019-02-15 21:25:27 +01:00
Umherirrender cdae062d47 Improve param docs and add @var to clarify types
Change-Id: I44f872b3a2921e75aab8e22fec57735f17ee1d8b
2019-02-15 21:23:02 +01:00
libraryupgrader 5bd2eaf70e build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: Ifd3dde125bae36b1076576ddc0c8b09eadd18a72
2019-02-06 13:01:32 +00:00
Matěj Suchánek 8994407a7d Remove duplicate notifications after merging users
Bug: T103747
Change-Id: Ic2612e5d7861ef7c6a22ab66fd3b9d6ea71f959f
2019-01-16 18:38:34 +01:00
jenkins-bot 729111443e Merge "Display the full title in notifications about mention in summary" 2019-01-07 22:10:51 +00:00
Matěj Suchánek ed171889bf Avoid double escaping of select options
Since the correct transformation method is unclear, change them to plain message keys.

Bug: T211876
Change-Id: I055c089574e7dcf5d634da402290a2ad024126f9
2019-01-05 11:06:20 +01:00
jenkins-bot b6fab8150a Merge "Add missing use for Wikimedia\Rdbms\Database" 2019-01-02 21:22:48 +00:00
Umherirrender d042257d40 Add missing use for Wikimedia\Rdbms\Database
Change-Id: I0c4beb49d1042c3ebe09b3d6e036b1028426715f
2019-01-02 19:40:58 +01:00
Umherirrender 795d48d539 Required argument follows optional
Remove default value, it is already list in param doc

Change-Id: Icbea3afce6abfbc075136798959521046ce86ab0
2019-01-02 14:52:14 +01:00
Matěj Suchánek cb1051ce19 Display the full title in notifications about mention in summary
It always puzzles and confuses me when I get this notification without the namespace.

Change-Id: I03711575d8ddbdfb07879982640dfdcb7b69b3ab
2018-12-31 16:43:56 +01:00
Thiemo Kreuz 0a6e548e4e Some more specific array and array[] type hints
Change-Id: I2c518410df779683dfd70aacd5084f55d6766498
2018-12-17 11:45:39 +01:00