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
Uses the magic value '[]' to mean 'no title'. This is a bit ugly,
but I think introducing an additional ¬withouttitle=1 parameter
is uglier and results in more code.
Change-Id: I83278182aeaf3905eb0f3e24c4c6c247720b1e76
Check for proper unserialization in EchoEvent::loadFromRow(), and return
false if not possible. Callers were updated to check for a false return.
Bug: T73489
Change-Id: I33867aa9bbbc5f0ecfe0d2a9e1b03eb1a937ae83
Formatters based on presentation models for
individual event emails and digest (daily, weekly)
plain text emails.
Bug: T121067
Change-Id: I4eceaf521315adab7429a8a73ffca70ebcddab86
Notifications were being marked as read in response to a click event
in JavaScript, but that causes a jarring effect in the UI, and it's
not reliable (the browser could abort the AJAX request).
Instead, add ?markasread=XYZ to the end of every primary link URL,
where XYZ is the event ID.
Bug: T133975
Depends-On: Icb99d5479836fea25a47451b5a758dd71f642f71
Change-Id: I8047d121584b43e6172463a50ad0e0de5f7fa73c
This reverts commit e372f3ce6f.
The previous attempt was broken because
EchoTargetPageMapper::fetchByUserPageId() returns a list of
EchoTargetPage objects, not a single one.
Bug: T117531
Change-Id: Id02a025e3736a7b92d9d6fb8adf29ef674f8e2fa
We calculate how many messages and alerts are being marked as read, and
subtract them from the count since the database and caches won't be
updated until the end of the request.
For performance, we also get the event_type while doing the
EchoTargetPage lookup query to avoid having to query it individually
later on.
Bug: T117531
Change-Id: I0d9302adf1b4b07a4ff26a04b00d4498aa3fe7ee
Right now, it'll only respond a certain, fixed, amount,
not allowing you to paginate the list.
Note: haven't properly tested all possible cases yet!
Change-Id: I84761b13a1b9203cb8e3fcc80941d739cd28659f
The only difference at this point is that fetchByUser initializes
the EchoNotification object with $targetPages. It doesn't really
matter that it doesn't have the target pages, since fetchUnreadByUser
is currently only used in the flyout, where those target pages aren't
used. But regardless of what method was used to fetch the data, I
think the data should be the same.
And now, there's less code duplication...
Change-Id: I04c7b98794af5427a2217dd337108e7eea1e65c5
It's basically impossible for DatabaseBase::select() to return false now
that ignoreErrors() is protected. So always return an array so callers
don't have to worry about false.
And remove a test that checked the result if DatabaseBase::select() did
return false.
Change-Id: I9ca8511585403d8c0ec262898ad4e61c2b038d51
Although it wasn't here even before
c94c3f3dad , loadFromRow will make
use if it if it's present. Otherwise, it's the current timestamp
(which seems odd; if we really don't need the timestamp in a
particular scenario, null would be more straightforward).
This is also public (getTimestamp()).
Change-Id: I9d88d86dde5b7f9b5965c81225a2aab4354c2baa
Follow-up I6c956738, which started trying to pull notification_timestamp out
of nowhere. Although EchoEvent::newFromRow may try to use this if it's set, it
wasn't previously getting selected and this is now causing exceptions.
Bug: T105890
Change-Id: I2dd9e268428d651813d8c43d85d54fc97634cd41
As needed by EchoEvent::loadFromRow().
Alternatively, just '*' as in MWEchoEmailBatch::getEvents().
Bug: T105890
Change-Id: I6c956738125658607d5e548efad4031c3298020f
getNotificationCount & getLastUnreadNotificationTime have an
argument $cached that allows cache to be bypassed & read from
DB. That result is then stored to cache.
In practice, it seems to be used only for cache invalidation.
getLastUnreadNotificationTime didn't allow to specify the DB
to be read from, and EchoNotificationMapper::fetchUnreadByUser
only read from slave.
So when we wanted to invalidate the cache, we would end up
immediately repopulating it with data from a (potentially and
likely) lagging slave.
I've made it accept the DB type, similar to getNotificationCount.
Bug: T98421
Change-Id: Ie4b09eeb04b9827b454cb2d92ee8c674bdd59a19
Previously this was loading 25 unread notifications. If less than 25 were
found it would add in 3 read notifications so it wasn't empty.
This patch changes things around to always return 25 notifications if the
user has at least that many. Instead of backfilling a static count of 3
we backfill 25 - $count with previously read notifications.
Change-Id: I723316486216d7b9dacfcc9765c1a8212e973518
Has a performance impact, so this depends on deploying the job
that deletes older notifications.
Bug: 69919
Change-Id: Ia485c853d1b04c3c85e25e6a12f5060a046e9b11
The special page will now not auto mark a notification as read if
it has a target url. Currently no notifications have target urls
but this will be changed in a later patch...
Change-Id: I9bd71d59391189d5d761ab5f1c84af0bc3554be0
This was supposed to merge master into the two_tabs branch, but it was accidently done against master instead
This reverts commit 06ee936e92.
Change-Id: I98da735b7d5c103399a2478286d1420243df6ba4
* This will be used for the unread notifications in message overlay
* This will be used to "mark all as read" based on sections ( event types ),
since we can't do updateJoin. We could set a max update limit like 3000,
and use this to do "mark all as read", this would handle majority "mark all as read"
use cases. This would also prevent updating big amount of data on a web request
Change-Id: I2a9103a73d0aa91a52d5c0233e946a0ef979f96d
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
* Shared function can be put in the abstract class and this also enforces some interface methods
* Initialize a default dbFactory when it's not passed to the mapper
Change-Id: I1033dafaa90a1f683fbe9ad69bed04f4844e357b
* Get rid of EchoBackend by separating responsibilities into smaller objects
* Move main fetchNotification logic from API to a more appropriate place
* Add more unit testing coverage
Change-Id: I42f4d7566543332588431c21c220c0d64d026b70