Commit graph

1093 commits

Author SHA1 Message Date
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