Commit graph

127 commits

Author SHA1 Message Date
TChin ceeba5efe6 Replace deprecated Title::newFromIDs
Bug: T291288
Change-Id: I259d3f8d4c4fc7cd8ce008f3e63d1208c2b002b7
2021-10-01 16:22:36 -04:00
Michael Holloway 5eb4c6cd1d Add notifiertypes parameter to ApiEchoNotifications
Previously, ApiEchoNotifications returned only events which were
enabled for the `web` notifier type. With this change, the notifier
type or types to consider can be specified by argument to the new
`notifiertypes` parameter.

This change is required so that the apps can request notification
content from the API for push notifications.

Bug: T287909
Change-Id: I2d1155e113f2defb0f02416a7a659c3ee162d3a6
2021-08-17 10:27:14 -04:00
Petr Pchelko e609db33ff Replace deprecated UserLoadOptionHook
Bug: T286576
Change-Id: I36d59813f25268097b822919d4236a41e0ea363a
2021-08-03 07:28:31 -07:00
jenkins-bot d9f43ee2f0 Merge "Replace deprecated UserSaveOptions hook" 2021-08-03 14:20:36 +00:00
DannyS712 5d3c416672 Remove ParserTestTables hook handler.
This hook is no longer called in MW 1.36+ by core, and this
extension already requires MW 1.37+

See I5124789fac333a664b73b4b4a1e801ecc0a618ca

Change-Id: I420c2a231cc1c7d6a350a1f04f7c7d4fd942b377
2021-07-30 04:00:17 +00:00
Ottomata 7336a1a67c Finalize migration of EchoMail and EchoInteraction to Event Platform
Also remove produciton of inactive Echo schema.

Bug: T287210
Change-Id: Ifc7f5aa22e62e7308f729de5a7fcf3fad9519615
2021-07-28 19:29:26 +01:00
TChin 113230aaed Replace deprecated UserSaveOptions hook
Bug: T287472
Change-Id: I170cd7f5676459f83e7b1abadf5485486b8caaab
2021-07-27 15:24:51 -04:00
Petr Pchelko a10b0b07c8 Use CentralIdLookupFactory and pass UserIdentity
Change-Id: I44144df7cf244eb867c1b261c10cc29b020f8409
2021-07-21 19:23:42 -07:00
Matěj Suchánek 3f05f8a71b Drop unused property and inject a service to SpecialDisplayNotificationsConfiguration
Change-Id: I0f238b863638245eef381e540da7d610d01bd25b
2021-07-17 10:40:45 +00:00
ZabeMath 3befbe0a69 Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: I001301fb95635c421a0bbb921fd909c5312dc896
2021-07-17 09:52:53 +00:00
Nicholas Ray 3a351cfb4f Move talk page notification data from 'user-menu' to 'notifications'
**Note**: This change will affect the order of the yellow talk page
message notification on legacy Vector/other skins by moving it from
after the `#pt-notifications-notice` element to before the
`#pt-notifications-alert` element. This was done because the
notification is related to the list of messages that appear when the
bell icon is clicked so having it in close proximity to that icon is
hopefully more intuitive than having it next to the unrelated inbox
icon. [1]

Per T274428, we need this notification to be inside the `notifications`
array instead of inside the `user-menu` array.

Additionally:

* Per T274428, update the notifications message copy to "You have a new
Talk page message"

* Remove the `onPersonalUrls` hook method inside EchoHooks,
unregister its use as a hook in extension.json, and update its
references in Echo.

[1] T274428#7113896

Bug: T274428
Change-Id: I5ae0ec089bcf0eec1ec7ac13f60e811f54e1d8e1
2021-05-25 18:24:29 -06:00
Cindy Cicalese ccfb1dbbda Replace usage of deprecated User watchlist methods
Bug: T281187
Change-Id: Id380a5441e30041b6fb79f6ad1fc0506b6a770f9
2021-04-28 17:17:26 -04:00
mainframe98 d426e6fb54 Provide notifications icons through content navigation
Ia1451e3e802441162eecfc5b7f6a7ba2ae72f377 introduced
the notifications content navigation, which allows skins
to choose where they want notifications to be positioned,
rather than requiring them to manually extract them from
the personal tools.

Bug: T266613
Depends-On: Ia1451e3e802441162eecfc5b7f6a7ba2ae72f377
Change-Id: I7badfd9bf9257b2537596e9f2e93248f52e4bd82
2021-01-27 17:36:24 +01:00
jdlrobson 2f020163ee Restore old Echo styling through several reverts
These dont work. Timeless provides its own skinStyles for this module:
* Revert "Timeless skinStyles should be additive not replace"
This reverts commit 98d0d296a8.
* Revert "Use skinStyles for deciding where the text-indent should apply"
This reverts commit 8adab78547.

A new implementation in Vector means these are redundant:
*  Revert "Item label can now use overflow hidden"
This reverts commit b5dd7baa08.
* Revert "Drop text indent in modern Vector"
This reverts commit 150fc7a16c.

Bug: T264339
Depends-On: I2afc12504d7184583fa8331479125474c68017dc
Change-Id: Ifd0dd5a0479588664b772fb839dbbcd8d7c47320
2020-10-29 16:59:45 +00:00
jdlrobson 98d0d296a8 Timeless skinStyles should be additive not replace
Sorry I made a mistake in my change and clobbered the existing
skin styles rather than extending.

Without this the notification icons will spill on to a second
line.

Follow up to 8adab78
Bug: T266135
Bug: T265806
Change-Id: Ic733a393636309e1bc4536141214fa420eed3e04
2020-10-21 17:59:04 +00:00
jdlrobson 8adab78547 Use skinStyles for deciding where the text-indent should apply
The code previously suggested it was only needed for Monobook and Vector
but it was also being used by timeless as discovered when 150fc7a16c
landed. This follow up applies the text-indent in the skin styles to ensure
it goes where needed.

Bug: T265806
Change-Id: I76a26a0a497f6bf7bb5f53967ea625f7e5d06ff7
2020-10-19 18:13:21 +00:00
arttsymbar 355e171eaa Notification: add skin specific(WikimediaApiPortal) z-index for menu overlay
Bug: T259735
Change-Id: Ib46d77a7d78107282b14e84bedb545886ba182e8
2020-09-07 11:30:26 +03:00
Reedy 257de880c1 Make use of BatchRow(Iterator|Writer)::setCaller
Bug: T261014
Change-Id: I51df93a9ed998c25e632c35b0fcc531615ddfb80
2020-09-05 03:45:55 +00:00
Michael Holloway 3513c642dd Create push subscription manager group/right to clean up dead subs
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
2020-08-20 17:08:48 -04:00
edwintam ad8f052a69 Fix: Add newly created aria-label message to extension.json
Bug: T260505
Change-Id: I585156b666dbe9ae0a04d03ac9fb8b951b97fbd4
2020-08-16 19:38:21 -07:00
Michael Holloway 15d48278be Create and enforce a config setting for max subscriptions per user
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
2020-08-12 17:58:11 -04:00
Amir Sarabadani 532fdbf294 Stop using ResourceLoaderTestModules hook
This hook is deprecated and we should use QUnitTestModule in extension.json instead

Bug: T232875
Change-Id: I7b3e22856adc64ee36e0b696e2371bb9673e4899
2020-08-03 13:18:29 +02:00
Ed Sanders d43ceb8978 Merge in styles from Minerva
Drops some no-JS styles (.mw-echo-notification) which didn't do anything useful.

Bug: T258936
Change-Id: I72bedc3c3d633e8898c93d5e7d570b8ee7b6a1ff
2020-07-27 23:19:51 +00: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
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
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 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
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
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
Reedy a07519962a Move one class to AutoloadNamespaces
Bug: T187154
Change-Id: I8f22119ebd6666da5c441e5ba6eb972b314a6fc9
2020-04-19 00:44:13 +01:00
DannyS712 c87da1142f Remove unneeded dependency on 'mediawiki.notify'
The single line of code it contained is part of mediawiki.base as of
MW 1.35, and the extension only supports MW 1.35+

Bug: T233676
Change-Id: Idcd456bd924e84ea53e1bb090267ef8d1ed35a94
2020-04-09 02:53:25 +00:00
Umherirrender 4337586f4a Use MediaWikiServices::getAuthManager
This required MediaWiki 1.35

Change-Id: I91de51208be72ad0eebc15c3d74069360014085e
2020-04-04 16:59:12 +02:00
Akinwale Alagbe b49fdb88c3 Add aria-label to Notifications page “Recent activity” filter widget
Adding `aria-label` to the filter widget, with `listbox` role assigned 
to allow screen readers parse read the content.

Bug: T244543
Change-Id: I72a4045abe9a7c391ee3fe471ed944d96259b79e
2020-04-03 20:00:22 +00:00
Daimona Eaytoy c256faf968 Remove hack for PHPUnit's Stub interface
This partly reverts commit c19c88567b.

Bug: T192167
Depends-On: Ia12658554c94497a204b7f65f1a6f7b1fa0310ac
Change-Id: I4ef736d87d05f74920ce88f57b0ad824986adb26
2020-01-23 12:34:48 +00:00
Roan Kattouw e771f57af8 Hide "system" categories in notification preferences
Make sure that the system-noemail and system-emailonly categories are
hidden, the way the system category is, by setting their no-dismiss
setting to "all". This should be unnecessary, because e.g.
system-noemail doesn't allow email, so just setting no-dismiss to "web"
should suffice, but
EchoAttributeManager::isCategoryDisplayedInPreferences() isn't smart
enough to see that. Doing it this way is also more future-proof for if
we ever add more notification methods in addition to web and email.

Change-Id: I00641d43a4eb1d3e2d3ea285682cf900733b1855
2020-01-06 10:59:51 -08:00
Umherirrender c25962ce47 Move test-only classes to new TestAutoloadClasses declaration
Bug: T196090
Change-Id: I1348c07c688cce6e9cd65669c824561bac1a1eff
2019-12-31 00:23:54 +01:00
jdlrobson 5b628b5109 Style improvements to Echo OOUI dialog in desktop Minerva
* Make sure the badge for desktop when initialised points to the
right thing
* Make sure the dialog takes up the full screen and the Clippable bug
does not interfere with the display of the pane

Bug: T241090
Change-Id: I6c5588ee689633cef413ef27449aeeea341d7a97
2019-12-20 20:38:36 +00: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
Daimona Eaytoy c19c88567b Hack: back-compat for PHPUnit's Stub interface
Until PHPUnit7, the Stub interface came from phpunit-mock-object, and it
was at PHPUnit\Framework\MockObject\Stub. Then, phpunit-mock-object was
merged into PHPUnit, and:
 - The interface above was moved to PHPUnit\Framework\MockObject\Stub\Stub
 - The FQSEN above started pointing at a completely different interface
 
This is a temporary hack to allow upgrading to PHPUnit 8, and MUST be
removed as soon as the upgrade is complete.

The :string typehint is also necessary in PHPUnit8, and it will work
with PHPUnit 6 as well.

Bug: T192167
Change-Id: I07cebd07088bced5c5ddc62936f0098dfa39e151
2019-11-18 16:58:18 +00:00
Martin Urbanec 2f26e7cc59 Create system-emailonly category
I need this category to be able to complete T231395,
it doesn't make sense to web-notify user they were renamed
since renaming kills user session, so when they log in,
they already know.

Bug: T231397
Change-Id: Ib49a42969a2134bb89c17f62a7aea7db820374fa
2019-10-30 17:51:39 +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
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 7dacde99d1 Remove unused dependency on ext.echo.styles.notifications
This module only contains styles specific to Special:Notifications, so
ext.echo.ui shouldn't depend on it.

Change-Id: I14fc0076ab634d3bc5082402a9e069d76cf16d07
2019-08-07 16:48:55 +02:00
jenkins-bot 495a6c8acd Merge "Remove ext.echo.base" 2019-08-01 00:24:25 +00:00
Roan Kattouw 5c3e30b78a Remove ext.echo.base
It became unused and was deprecated in 1ac72cc01a.
That was almost 4 years ago, back when these definitions were
in PHP instead of JSON.

Change-Id: Icbd5ee8df1fc339ffb2df9f05c35a9dcd545a3d1
2019-07-31 22:53:23 +00:00
shivanshbindal9 6be1eee1db Display notification text for incoming notification
As now polling is used to update the notification count on header icons.
If there are any new notifications then a snippet containing the header
part of the notification will appear using mw.notify().

Bug: T226130
Change-Id: Id38c8ebedebd4c68b9cef0635043d6f9304784dd
2019-07-31 17:54:20 +05:30