Commit graph

10 commits

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