Commit graph

26 commits

Author SHA1 Message Date
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
Daimona Eaytoy 5580c7714a Update column names in SQLite patch file
According to the current schema.

Change-Id: Ie044a4217db7ef52c6e3a2cec001f6b44b198bd7
2019-04-11 13:27:16 +02:00
Umherirrender f7fc33e7f7 Do not recreate echo_event.event_page_namespace on sqlite update
column event_page_namespace was dropped from the database
When running the updater for sqlite on a fresh install it fails
Function: Wikimedia\Rdbms\Database::sourceFile(
/workspace/src/extensions/Echo/db_patches/patch-event_variant_nullability.sqlite.sql
)
Error: 1 no such column: event_page_namespace


Change-Id: I397e601dd9db45fc34669c43df5f9dd8d337ed95
2019-04-10 20:09:13 +02: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
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
jenkins-bot 7fa34bcfba Merge "Add a primary key to the echo_notification table" 2016-11-23 18:35:53 +00:00
Stephane Bisson b3c07eedeb Remove etp_user
Target page entries used to exist for each user
that was notified for an event. They were
removed as the notifications were marked as read.

Now they remain so that the association between
pages and events can be used for moderation
regardless of the notifications read status.

This patch removes everything about
echo_target_page.etp_user from sql and php code.

Bug: T143959
Change-Id: Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a
2016-09-09 09:32:28 -04:00
Roan Kattouw fea95cdb49 Add a primary key to the echo_notification table
Take the existing unique index on (user, event) and make it the PK.

Bug: T136428
Change-Id: I659953d80bf3bcf3a6303fa6e09aefed2ecb1987
2016-09-07 21:49:09 -07:00
Roan Kattouw f766002fbc Add index on event_page_id
Bug: T143961
Change-Id: I15abd7c901df58f7eb9e5476d58a1bc12835645e
2016-08-25 18:35:39 -07:00
Stephane Bisson 24caf50ff6 Dynamic bundles
To allow individual notifications to be
marked as read/unread or moderated,
bundles are created by grouping associated
notifications when they are fetched for display
instead of when they are created.

From a product perspective, this change doesn't
introduce moderation or expandable bundles but
it counts each individual notifications.
For instance, the bundled notification
"3 new topics on PageA" now counts as 3
notifications.

Bug: T93673
Bug: T120153
Change-Id: Iacd098573efd92bb1e3fcd7da4cd40cea9522f15
2016-06-27 09:49:13 -04:00
Roan Kattouw 617cd3d29e Add index on notification_event
So we can easily query the notification rows that belong to
a given event row. This is needed for the removeOrphanedEvents
maintenance script to run efficiently.

Change-Id: I99fc31a62b37259d7000577583c8e8a599e400f9
2016-06-14 19:57:06 +00:00
Kunal Mehta b85f978ddd Track what wikis a user has unread notifications on
This implements a backend layer and database storage for tracking what
wikis a user has unread notifications on. It is not yet exposed via any
API.

Whenever the notification counts on the local wiki are reset, a deferred
update is queued to also update the central database table.

Change-Id: Id1498bdeb5811d6848dc66781ffca03e726eab90
2015-11-20 15:54:11 -08:00
Erik Bernhardson 70639162f3 Allow multiple target pages per event
Bug: T85064
Change-Id: I338f3d73efb98a3bb66ef64fdeeb66e752a453c2
2015-03-31 07:56:52 +00:00
bsitu 029668423d Add TargetPage model and mapper to notifications
This will be used for marking a notificaiton as read when
a user visits a target page. The new table should keep the
volume as low as possible for fast data loopup. records
should be removed from the table once it's marked as read.

Change-Id: I605cbc79adfc12d22bd889c5bb513d05c479fe6e
2014-08-13 00:48:07 +00:00
Dereckson 85181d3aa1 SQLite compatibility for Echo database patches
These patches allow Echo update to stay compatible with SQLite.

Change-Id: Ie4d0b4ec40bcc504096e87f469be0e96271daec1
2013-10-15 20:56:24 +00:00
Erik Bernhardson 34fbeaf8c9 Respect revision suppression within Echo
Update the echo formatter to properly display suppressed revision content

Bug: 48059
Change-Id: Iee3c9a41ad24c66b0e2abdd5f1375ebdbd74314e
2013-06-18 11:00:50 -07:00
Erik Bernhardson 052a4818f6 Rename index for sqlite support
SQLite requires unique index names across the full database.  A previous
patch I9b6468221ba6fe501b15c563f3301694262eec65 renamed the index in
echo.sql but forgot to apply the same change to existing databases. This
resolves that mistake.

Change-Id: Ibb629149afd9f4ca55cac613124fce42500aa8f9
2013-06-14 13:14:21 -07:00
Erik Bernhardson 68a4587460 Repairs necessary for echo to support Sqlite
Sqlite's lack of an 'ALTER TABLE CHANGE' statement has prevented echo from
supporting sqlite, and by relation has prevented Echo's unit tests from
running within the foundations jenkins CI environment.  This patch detects
if the database is currently an sqlite database and applies a specially
formulated patch that performs a rename/copy/delete operation to get
the equivilient of an 'ALTER TABLE CHANGE' command. Additionally renames
one index to have a more unique echo-specific name.

Bug: 41987
Change-Id: I9b6468221ba6fe501b15c563f3301694262eec65
2013-06-13 14:34:33 -07:00
Erik Bernhardson f38ce97efd Database updates for respecting oversight within Echo
Provides the first step of adding and populating a new database field
for Echo oversight deployment.  The new field is populated via a
maintenance script and Event::loadFromRow will accept both new and old
results.  Everything will still run when the 2 now unused fields are
later dropped from the db.

Bug: 48059
Change-Id: I24d4b61a061f94ed9aaaa6087f33b2ab37f773cd
2013-06-10 14:52:18 -07:00
bsitu d44ed993a2 Add email bundling function to Echo notification
* This patch needs intensive testing on Redis delayed job queue
* This patch is -2 mainly for redis/phpredis are not ready on test/test2/mediawiki

To test this locally, you need to:
* set up Redis and phpredis locally
* add the following to localSettings.php
    $wgJobTypeConf['MWEchoNotificationEmailBundleJob'] = array(
        'class'       => 'JobQueueRedis',
        'redisServer' => '127.0.0.1',
        'redisConfig' => array( 'connectTimeout' => 1 ),
        'claimTTL'    => 3600,
        'checkDelay'  => true
    );
* set $wgMainCacheType to CACHE_DB or memcache
* set $wgEchoBundleEmailInterval to smaller number for testing purpose, 0 to disable email bundling

Change-Id: I9313e7f6ed3e13478cec294b5b8408fe8e941faf
2013-04-11 11:25:14 -07:00
bsitu e40a243d59 remove unused table and columns
1. echo_subscription
2. echo_event.event_timestamp

Change-Id: I9f6d4041b16c6d1d0414ee8e81536a59d0aba3d4
2013-04-09 10:56:28 -07:00
bsitu 6a3624b0e4 Add web bundling function to Echo notification
* add web bundling feature
* unify event_timestamp with notification_timestamp
* remove echo_subscription
* update article_link to page_link notification with new logic
* remove duplicated function from MWDbEchoEmailBatch since it's defined in parent class

Change-Id: I2fa91c44edb020209b468fe13f894d9db3732e69
2013-04-04 10:53:46 -07:00
bsitu 6b8571403a Initial check-in for email batch
patch set 3:
	* add gender support to various messages
	* tweak variables a little bit, e.g. move class variables to function local variables
patch set 4:
	* update various email to e-mail in i18n file
	* add support to process only valid echo events
	* add global email footer
	* add the new table schema to core schema file
patch set 5:
	* remove trailing white space
	* add missing semicolon to return statement in Notifier::notifyWithEmail()
patch set 8:
	* some change based on newest feature requirement

Change-Id: I3298617dab4c04c4d6d486469120fc2d0c986b66
2012-12-12 12:00:13 -08:00
Andrew Garrett 6ff170cada Echo: Implement advanced notifications for vanilla talk pages.
Uses the class EchoDiscussionParser to understand actions taken on
vanilla MediaWiki discussion pages.

Currently notifies on these occasions:
* A new comment is added to a discussion on your talk page or that
  you have participated in.
* A new topic is added to your talk page.

There are vague plans to expand to these classes of events:
* Your comment is edited or removed.
* A large section is moved to your talk page.

and these classes of users:
* Users watching discussion pages.

Change-Id: Ie6cae76ed2e0ecf607059e39ac1aa480a275ec89
2012-08-01 10:17:36 -07:00
Andrew Garrett ed388e1916 Fix SQL issue: make event_variant field nullable.
Change-Id: I5937d4e2f6be1e3face7094dfd5cdf5414ab3007
2012-05-18 11:10:41 +10:00
Andrew Garrett 8da85396d6 Initial commit of Echo, a notifications framework for MediaWiki.
This version is very rough.

For an example set of Minimum Releasable Functionality, this version will notify users on
changes to their watchlists or to their user talk pages.

However, it is still missing a conversion script to turn watchlists into echo subscriptions.

For now, notifications can be viewed through the new special page Special:Notifications, or through the API module provided.

Change-Id: I5867226e3e6195fbed81f4b5803e2310f057ffc4
2012-05-13 00:53:21 +10:00