Commit graph

21 commits

Author SHA1 Message Date
Stephane Bisson b215a5d7c0 Sort bundled notifications by read status AND timestamp
Change-Id: I21b00622828c5c518cf83e78457134a66ac71947
Bug: T139521
2016-07-06 16:02:04 -04: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
Kunal Mehta 64127cd815 Avoid exceptions when event_extra can't be unserialized
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
2016-05-13 16:39:17 -07:00
Kunal Mehta 26a8bc2450 Defer onPersonalUrls() DB writes to post-send (try #2)
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
2016-03-09 11:07:50 -08:00
jenkins-bot acdcb5c895 Merge "Revert "Defer onPersonalUrls() DB writes to post-send"" 2016-03-09 00:11:50 +00:00
Catrope e372f3ce6f Revert "Defer onPersonalUrls() DB writes to post-send"
Causes fatals in production for some reason.

This reverts commit 93387806c2.

Bug: T129299
Change-Id: Ie90aa493e2940fae9d6f380b95f87a4cc7e04622
2016-03-09 00:00:11 +00:00
Kunal Mehta b2961ccb0c EchoTargetPage: Don't call Title::newFromId() repeatedly
Title::newFromId() can return null, and if this were the case the
instance caching would never work, so it would continually make useless
database queries.

Initialize the $title member variable as false to begin with, and use
that to check whether we've already checked Title::newFromId().

Change-Id: Id07c2c963ffcd03e212bed0a666735bcb68b92e0
2016-03-08 01:43:08 +00:00
Aaron Schulz 93387806c2 Defer onPersonalUrls() DB writes to post-send
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
2016-03-08 01:41:52 +00:00
Kunal Mehta 7fbec72803 Always show the messages flyout icon
Bug: T127731
Bug: T124372
Change-Id: Ie97229b7ef34cd807f16c76ceae0682c425c53b4
2016-02-23 01:21:28 -08:00
Kunal Mehta 5be28ba4df Require a User object to be passed to EchoEvent::userCan()
All callers were already doing this.

Change-Id: If9e20e3d4740bcdb8842592e4cd988f8b35e1300
2015-11-23 16:08:17 -08:00
Aaron Schulz e261aa7593 Make EchoEvent::create() a no-op if the DB is read-only
This seems better for availability than stopping the world
and rolling everything back (or just throwing post-commit
errors that didn't stop the original change anyway).

Change-Id: I816b3cb5f0d26de608e620a01571a332aa832c05
2015-11-02 11:17:05 -08:00
James D. Forrester cd8c77df29 build: Enable phpcs rule 'MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment' and make pass
Change-Id: Ied1a479e6f5aa82d03e449ec10d655a921cd37e4
2015-10-29 13:06:14 +01:00
Kunal Mehta 8cfb10766b SECURITY: Handle suppressed usernames in non-revision based events
We only track revisions for some notification types, others still
reference usernames, but don't check for suppression status. If no
revision is available, use User::isHidden() to check whether
EchoEvent::getAgent() has been hidden.

Bug: T110553
Change-Id: I31e635e365bbb0f6c6ac63be2bdb07e5e2d67c96
2015-10-16 14:56:43 -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
Matthew Flaschen f9c5808912 Move edit-user-talk to messages
Also:

* Clear the newtalk flag when they mark all their edit-user-talk
  read.

* Remove the section caching system.  It was designed to avoid
  performance problems with Flow messages, but now that standard talk pages
  are in 'messages', messages should be relatively common (alerts
  were already not cached by this).

* Minor cleanups to reflect that messages are not only Flow (and
  a typo fix in the Gruntfile).

Bug: T108760
Change-Id: I82d7b1d08331693830d6a1749612b55e96b95cf9
2015-09-04 18:36:40 -04:00
jenkins-bot da6544e275 Merge "Split alerts and messages in Echo" 2015-09-02 22:50:40 +00:00
Moriel Schottlender 1ac72cc01a Split alerts and messages in Echo
Split the notifications into 'alert' and 'message' badget with two
different flyouts. Also clean up styling and module behavior.

** Depends on ooui change Id4bbe14ba0bf6c for footers in popups.
** Depends on ooui change Ie93e4d6ed5637c for fixing a bug in
   inverted icons.

** MobileFrontend must also be updated to support the new modules
   in this patch  I168f485d6e54cb4067

In this change:
* Split notifcations into alert and messages and display those in
  two different badges.
* Create two separate flyout/popups for each category with their
  notifications.
* Create a view-model to control notification state and emit events
  for both the popup and the badge to intercept and react to.
* Clean up module load and distribution:
  * Create an ext.echo.ui module for javascript-ui support and ooui
    widgets.
  * Create an ext.echo.nojs module that unifies all base classes that
    are needed for both nojs and js support, that the js version
    builds upon.
  * Create a separate ext.echo.logger module as a singleton that can
    be called to perform all logging.
* Clean up style uses
  * Move the special page LESS file into nojs module so all styles
    load properly even in nojs mode.
  * Transfer some of the styling from JS to LESS for consistency.
  * Make the 'read more' button load already with the styles it
    needs to look like a button, since its behavior is similar in
    nojs and js vesions, but before its classes were applied only
    by the js, making it inconsistent and also making its appearance
    'jump' from a link to a button.
* Delete and clean up all old and unused files.
* Moved 'Help.png' icon from modules/overlay to modules/icons for
  later use.

Bug: T108190
Change-Id: I55f440ed9f64c46817f620328a6bb522d44c9ca9
2015-09-02 15:36:37 -07:00
Matthew Flaschen b410f768f9 Document Event methods that can return null
Change-Id: Iecb3ba68ae48924c68781e195557954afd770af3
2015-08-19 15:18:27 -04:00
Kunal Mehta a7c36b0b86 Flip EchoEvent::getUseJobQueue() default
Rather than making each notification type opt-in to using the job queue,
make them opt-out by setting an 'immediate' => true flag.

Configure the 'edit-user-talk' notification type to be immediate since
it should not lag behind the orange bar indicator.

Change-Id: I707bc01a97082887c3f1c353d45cdf1c1eaeff04
2015-07-01 20:36:47 -07:00
Kunal Mehta df452abbb6 Don't hook into ourselves: EchoCreateNotificationComplete (part 1)
Change-Id: I5f0f3929a3b0396c98e0f3e74b69ddcee744a0e8
2015-06-15 17:41:10 -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