Commit graph

111 commits

Author SHA1 Message Date
jgiannelos 4abfbd3c96 Normalize eps_topic
* 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
2020-09-14 15:52:23 -04:00
Ammar Abdulhamid 95a0dff88c Add all ResourceLoaderModules using supported hook
PersonalUrls hooks is not meant to be used to add RL modules,
its documentation says it's meant to "alter the user-specific
navigation links (e.g. "my page, * my talk page, my contributions" etc)."

Echo is already using BeforePageDisplay hook to add modules, let's
now register all our modules via that

Bug: T259872
Change-Id: I12616a9947ea0e574287443361e2180c42e48d4b
2020-08-09 00:35:56 +01: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
jenkins-bot d8d0e52c03 Merge "Use user IDs, not User objects, for reverted-user-id" 2020-07-28 12:11:24 +00:00
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
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
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
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
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
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
jenkins-bot de09ddd4d9 Merge "Add push subscription management" 2020-06-02 18:21:42 +00: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
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
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
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
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
Umherirrender 4337586f4a Use MediaWikiServices::getAuthManager
This required MediaWiki 1.35

Change-Id: I91de51208be72ad0eebc15c3d74069360014085e
2020-04-04 16:59:12 +02:00
Ammar Abdulhamid ad8340ea59 Replace deprecated User::isAllowed with PermissionManager
Bug: T220191
Change-Id: I321a1d67a9272dfb305d76589c6371176f1afc16
2020-03-14 19:14:37 +00:00
jenkins-bot f281b221eb Merge "build: Updating composer dependencies" 2020-02-19 21:33:02 +00: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
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
Matěj Suchánek e16ff3a939 Remove dead code from EchoHooks.php
Change-Id: Ie1ff4977a61b9c0350b2c8891ce26b6fa8cf49e5
2020-01-05 14:38:26 +00:00
libraryupgrader ef3d2b886d build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: I03333636654eff80d4fe7fa543ac9e6c321af891
2019-12-29 11:59:32 +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
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
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
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
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
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