Commit graph

30 commits

Author SHA1 Message Date
WMDE-Fisch 4cb11b84ef Fix some doc blocks
Change-Id: Ieb55488792a4609e497a81687c04f4beb3b92b86
2017-11-07 17:06:17 +01:00
Umherirrender 546e3bdd55 Improve some parameter docs
Change DB_SLAVE in comments

Change-Id: Idd5787928b87f5af63864dc626cb603f281515d7
2017-10-18 18:44:52 +02:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
Umherirrender 5b4730c9bc Improve some parameter docs
Change-Id: Ie71fb080926781f2905e6264be060203c56185ea
2017-08-09 17:21:10 +02:00
Umherirrender 79b6f470af build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: I2326cf81e907f2a02615f96f922b66fd2806defd
2017-07-26 21:34:44 +02:00
Matthew Flaschen 813ab5b54e Fix user talk exception for blacklist
There was a null-dereference for events without titles.

Also, it should only whitelist their own user talk space, not e.g.
mentions on someone else's user talk space.

Bug: T150419
Bug: T166627
Change-Id: If7d9cad4eb33ce1f1e6b7d86244332ad5dece954
2017-05-30 19:42:20 -04:00
Kunal Mehta 5d2cde1022 Implement per-user notification blacklists
- Disabled by default, is a gated preference by wg variable
- User specifies blocks in Echo preferences
- Uses a TextArea with username separated by new lines as input
- Still allows notifications to come through on a user's talk page
- Cache the blacklist and whitelist

Requested at
<https://meta.wikimedia.org/wiki/2016_Community_Wishlist_Survey/Categories/Miscellaneous#Allow_users_to_restrict_who_can_send_them_notifications>.

Bug: T150419
Change-Id: Ibf548da4aa600bdc7848cba1947436e56ac48a4a
2017-05-24 16:09:04 -05:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
Matthew Flaschen ffd9d4bb4d Fix moderation controller
The change to use DeferredUpdates had a missing use.

Change-Id: Ied72608c9b3aa597627aa5ea069c257f506c3c1b
2016-09-20 01:44:25 -04:00
Stephane Bisson d7845da3f6 resetNotificationCount() from replica with no lag
When notifications are being moderated, the unread count
for affected users has to be recalculated.

It was initially done using DB_SLAVE but it was leading
to inconsistent data since that database did not know
about recently deleted notifications.

It was changed to DB_MASTER but it potentially led
to too many queries on master.

This patch tries to wait for the replica to have
caught up with those changes and use it to update
the unread count for the affected users.

Bug: T93673
Change-Id: Ib4a845e82f686dd7ed807ab21a28490014b56604
2016-09-12 19:59:02 +00:00
Roan Kattouw 48ca4aeb5e ModerationController: Update count from master, not slave
At the time that resetNotificationCount() is called, we've only
just moderated something, so the slave won't have those changes yet,
and the computed notification count will be wrong.

Change-Id: Ia83f2b9cf7f4bbaee25e03f7bc8f73bcd4d345f9
2016-09-08 15:26:07 -07:00
Stephane Bisson 6e2236db81 Moderate notifications
* When a page is deleted, moderate associated
  notifications. When it is undeleted, unmoderate.

* When a notification cannot be rendered
  (canRender() returns false), moderate it.

The biggest advantage of moderation over mark-read-and-ignore
is that those notifications are filtered out at the database
level from this point on. They are not re-processed every single
time and do not affect the number of notifications returned by
the API.

Bug: T140327
Bug: T140836
Bug: T141463
Change-Id: Idefe78408fd584c13aaa9174cee3055539d92848
2016-08-19 22:20:04 +00:00
Stephane Bisson cf71009638 Remove deprecated formatter
Followup to I639b9d9906d3ff37021cb9b5ed3cb401354b5bd9

* Remove deprecated formatter
* Log a warning and fail gracefully
  when an event type does not support
  Echo presentation model.

Bug: T121612
Change-Id: Ic5712c4ce265b6faabce7a4028b4294fe3c73f18
2016-07-20 11:00:34 -04:00
Stephane Bisson 2f0ff9cbf6 Cleanup old notification formatting system
* Deprecated main entry-points
* Removed unused configuration
* Removed old formatters for Echo events (mention, edit-user-talk, etc)
* Removed unused messages

Bug: T121612
Change-Id: I639b9d9906d3ff37021cb9b5ed3cb401354b5bd9
2016-07-11 16:57:14 +00: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
addshore 5b2ad7617c Remove overwritten $notifyTypes array
Change-Id: I8ee6fab3285881f29e9484b1bdd0a52a1509a1e9
2016-05-20 11:43:48 +01:00
jenkins-bot f6affc4655 Merge "BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical" 2016-04-23 02:27:40 +00:00
Matthew Flaschen 5ecc6aa7c8 BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical
Merge and deploy at the *same time* as:
* BounceHandler - I3c669945080d8e1f67880bd8a31af7f88a70904d
* mediawiki-config - I13817c139967ed9e230cfb0c87c5de66da793c96

Despite claiming to be about categories, $wgEchoDefaultNotificationTypes
was actually configuring both categories and types (which go inside
categories).

For example, 'thank-you-edit' is a type, but 'emailuser' is both
a category and a type (when used as a category, this has special
effects at Special:Preferences).

Since types and categories can and sometimes do have the same names,
this leaves no way to properly and clearly configure them.  It also
makes it difficult to document what is going on (as required by
T132127).

Split into three variables:

$wgDefaultNotifyTypeAvailability - Applies unless overriden

$wgNotifyTypeAvailabilityByCategory - By category; this can be and is
displayed at Special:Preferences

$wgNotifyTypeAvailabilityByNotificationType - By type; this cannot
be displayed at Special:Preferences. To avoid confusing the user,
we introduce a restriction (which was previously followed in practice,
AFAICT) that types can only be overridden if the category is not
displayed in preferences.

Otherwise, it can look to the user like a category is on/off, but the
types within might have the opposite state.

Due to this configuration change, this is a breaking change, and needs
coordinated deployments.

This also lays the groundwork for T132127

Also change terminology to consistently use "notify type" for web/email.

It was mixing between that and output format (which unfortunately
sounds like the API format, e.g. 'model').

Bug: T132820
Bug: T132127
Change-Id: I09f39f5fc5f13f3253af9f7819bca81f1601da93
2016-04-22 19:08:12 -07:00
Aaron Schulz 33fe3490d3 Switch $wgMemc usage to proper cache/stash usage
Change-Id: I688e21ff4ff999f11c0373ad611075c14fa5db2a
2016-04-22 11:58:03 -07:00
Matthew Flaschen cac85b635f Make plural support for large values (100 or more) explicit in l10n
This involves:

* Making this value no longer admin-configurable.
* Changing getNotificationCountForOutput to return only a single value
  Since there is no + in the formatted value anymore, we can actually
  use the same value for both.

  This is a B/C break, but hopefully worth it to simplify the method
  call.

  For now, the excess parameter is just marked unused.  It could be
  removed at some point if the translations are updated.

This must be merged at the same time as:
* Flow - Ibfa56b1af9e8c56b4c5f900e0d487bc09688b2a2
* MobileFrontend - Ibf784b279d56773a227ff261b75f2b26125bbb63 (well, MF
  can be merged first)
* translatewiki - I2a4b6938aed49e4101deb6b9351c43656a863490

Also, change 1 to One/one, per Siebrand on the task.  This can easily
be dropped/undone if we don't want it.

Also, remove reference to no-longer-existent notification-page-linked-bundle

Bug: T127288
Change-Id: Iabeaae747f99980c0610d552f6b38f89d940b890
2016-03-16 18:43:16 -04:00
Matthias Mullie 799d4de339 Comparing User objects is unreliable
Objects can be different instances (and for User, they can contain
very different data) in which case they wouldn't be recognized even
if they were the same user.
Let's find by ID instead.

Bug: T124803
Change-Id: Ia166fd4190f264354cea83d98047c62c7e0714ea
2016-02-11 14:48:29 +01:00
Matthias Mullie cc11b3c81a Allow certain users to be excluded
Right now, if certain users should be excluded, that would have
to be part of the user-locators already. This is annoying because
it's hard to write "generic" user locators when you want to exclude
just a couple of people in certain cases.
In Flow, for example, we have user-locators for users watching a
board or topic. We don't want to send the notification to people
that have also been mentioned in that post (they'll get a separate
notification). We could build that exception into those
user-locators, but then we couldn't re-use them in other places...
This basically means we couldn't use EchoUserLocator::locateUsersWatchingTitle,
we would have to roll our own that also excludes mentioned users.

Instead, this lets you add 'user-filters' (that functionality
actually exists already, but is not currently exposed), which
lists users to not send the notification to, even though they could
be in a user-locator.

Bug: T125428
Change-Id: Ifa0e2d3283f57624af4c5ec264f9f66223508e83
2016-02-04 11:20:59 +01:00
Kunal Mehta ba957d399a Allow presentation models to indicate a notification can't be formatted
Adds EchoEventPresentationModel::canRender() for notification types to
indicate that something can't be rendered if for example, a page is
deleted.

In that case, the notification is marked as read in a deferred update.
All callers were also updated to check if the notification was formatted
properly.

Bug: T116888
Change-Id: Idb975feaec893ef86c41cc487102e3539c07e328
2015-10-28 18:28:08 -07:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
Kunal Mehta 9e245d8ce0 Remove unused globals
Change-Id: I23e1df7a245b08cb5d5491f01b5eea6630be3b29
2015-08-13 10:52:24 -07:00
Kunal Mehta 92da0124d0 Only require event type to construct a formatter
Push the $wgEchoNotifications dependency to
NotificationFormatter::factory(), and only catch exceptions we're
actually expecting (NotificationFormatter::format()).

And clean up the logging to use structured logging while we're at it.

Change-Id: I7e18c318c5c81b6a38e55f27ef8f604654f10858
2015-08-10 11:27:52 -07:00
Kunal Mehta d072a9a47b Add some type-hinting and doc fixes
And remove some useless code as well.

Change-Id: I97a2ca08a1d4ef0b59535c1c002840f108defe4a
2015-08-06 15:36:05 -07:00
Kunal Mehta cac31dd843 Fix doc comment in EchoNotificationController
Change-Id: I3b82206f93099959ed3c12aed7853762cc3da8e4
2015-06-15 19:02:05 -07:00
Kunal Mehta 1298f2bb74 Don't hook into ourselves: EchoGetNotificationTypes (part 2)
Change-Id: I51600bbb26594323831d22bc35d34587ff146d47
2015-06-15 17:43:54 -07:00
Kunal Mehta 9d08c96fad Move all PHP code into includes/
Mainly because I was annoyed at m<tab>o<tab>d<tab>u<tab> to reach
modules/.

Change-Id: Ib149cb2e2612ccddd0503f9d0c5d05b554860a00
2015-06-07 18:54:14 -07:00