Commit graph

242 commits

Author SHA1 Message Date
jenkins-bot e6e507a9ee Merge "Use db-replicated objectcache for storing last seen time" 2015-09-02 22:50:43 +00:00
jenkins-bot da6544e275 Merge "Split alerts and messages in Echo" 2015-09-02 22:50:40 +00:00
Kunal Mehta 35c4a37918 Use db-replicated objectcache for storing last seen time
So we're not abusing user preferences for the last seen time.
EchoSeenTime is a small wrapper around ObjectCache that handles the
fallback to user preferences during the transition.

All JavaScript code now needs to use mw.config.get('wgEchoSeenTime').

Bug: T95839
Change-Id: Ia45ba5e30eb4564250539d04d5886d2598ebd49a
2015-09-02 22:42:35 +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
Kunal Mehta 5d772ad76b Expose the revid of the event revision in the API
So custom applications can generate links to the revision
the event is about

Change-Id: I21d0417b9e014ff59f26a94cbcc28f22044a4a39
2015-09-02 11:03:02 -07:00
jenkins-bot fb18eededc Merge "Document Event methods that can return null" 2015-09-02 01:37:02 +00:00
jenkins-bot 8be487330d Merge "Put back notification_timestamp for web." 2015-08-28 08:02:48 +00:00
Matthew Flaschen f38dfc4d08 Bump mention limit to 50
Bug: T110306
Change-Id: I724ef5467a087c70538a8780b856091260b40be4
2015-08-26 19:16:36 -04:00
Matthew Flaschen f3342a6c39 Put back notification_timestamp for web.
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
2015-08-26 16:06:34 -04:00
Alex Monk 92dc3a0d3c Fix fatal DB exception
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
2015-08-26 13:31:51 +00:00
Federico Leva c94c3f3dad Select specific rows in EchoEventMapper::fetchByUserBundleHash()
As needed by EchoEvent::loadFromRow().
Alternatively, just '*' as in MWEchoEmailBatch::getEvents().

Bug: T105890
Change-Id: I6c956738125658607d5e548efad4031c3298020f
2015-08-22 10:11:39 +02:00
Kunal Mehta 4a5c99921d Fix typo in documentation
Change-Id: I7b9cdccd34fb5b7e988d812af834968d17ef7f53
2015-08-19 13:13:07 -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 0884859246 BasicFormatter: Add accessor to get the correct Language object
And use it in UserRightsFormatter.

Change-Id: Id47b903127e0dba79a9390153ce6c1a4f89023ec
2015-08-13 10:56:23 -07:00
Kunal Mehta 9e245d8ce0 Remove unused globals
Change-Id: I23e1df7a245b08cb5d5491f01b5eea6630be3b29
2015-08-13 10:52:24 -07:00
Kunal Mehta 7fc41f826d Fix typo in documentation
Change-Id: I3049b1b80bdc1b5fdeeb76d0e29f165620f33433
2015-08-13 10:51:33 -07:00
jenkins-bot 8759ac3d72 Merge "Reduce CAS errors in ApiEchoMarkSeen" 2015-08-13 16:52:02 +00:00
Aaron Schulz 2a0e98e9a9 Reduce CAS errors in ApiEchoMarkSeen
* These tend to log errors many times in a row for the same few
  users in any given time period. There is probably some usage
  pattern issue in JS on top of the abuse of preferences for
  such tracking state. In any case, this should help.

Bug: T95839
Change-Id: I4d57b1db43a63300a412a5de220b66081da754f1
2015-08-11 19:18:45 +00: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 5e2da7627b Refactor and unify icon URL logic
The logic to get the URL for an icon was duplicated in the
EmailFormatter and BasicFormatter. It is now in the abstract
NotificationFormatter, which EmailFormatter and BasicFormatter now
use.

Changes in logic:
* Throw an exception if an invalid notification type is provided instead
of a PHP notice
* icons using 'url' may have different ltr/rtl icons
* Throw exception if icon is supposed to have different icons for
ltr/rtl, but doesn't, instead of debug logging

The new function is static so it can be used in EmailFormatter as it
does not inherit from NotificationFormatter.

Bug: T60726
Change-Id: Ia3c01c35f58eed8cc2c039249ab1ec1a80a8abbb
2015-08-06 04:17:14 +00:00
jenkins-bot 8fda0c0568 Merge "Fix more "the job queue can run against different wikis"" 2015-07-31 23:38:43 +00:00
Stephane Bisson f6bef9d159 Remove useless and misleading comment
Change-Id: Id4d2f908f3fdf4a37f3e5a1ddc6b205db745802e
2015-07-31 15:46:53 -04:00
Kunal Mehta 410271897c Fix more "the job queue can run against different wikis"
It doesn't.

Change-Id: Ia3f7b459ddcbabf525bde2e1489dc9379a0a7ef5
2015-07-31 12:19:53 -07:00
Kunal Mehta 6515e1fd65 Avoid an extra memcached lookup in MWEchoNotifUser::getNotificationCount()
Change-Id: I32eb79beb494710c35b175f2dc15af42bdad61d7
2015-07-21 14:19:12 -07:00
Kunal Mehta e4d3b7e9fa ApiEchoMarkRead: Remove unused variable
Skips two(!) useless memcached lookups.

Change-Id: I6961e736a7ddf72478bdc6e684f5ebb9824560de
2015-07-21 14:16:06 -07:00
jenkins-bot aab214bc6a Merge "Userlogin is canonical name, not UserLogin" 2015-07-08 09:31:34 +00:00
Niklas Laxström 81f8df2249 Userlogin is canonical name, not UserLogin
Fixes: PHP Notice:  Found alias defined for Userlogin when
searching for special page aliases for UserLogin.

Change-Id: Ib64d4c76d3915ae752a9c56eb9635653e0da5623
2015-07-08 11:26:27 +02:00
Kunal Mehta 4d8b977ff9 Get rid of disabled 'echo-notify-show-link' preference
This preference has been disabled since bug 47562, and doesn't make
sense to keep around given that the flyout is the main interaction most
users have with Echo.

Change-Id: I7e8ddf96dbde9a95ac01a0cc83bad396151d01bd
2015-07-07 17:10:49 -07:00
jenkins-bot 71075b9262 Merge "Use PROTO_CANONICAL for icon links in emails" 2015-07-06 16:10:35 +00:00
Kunal Mehta b12efddf30 Use PROTO_CANONICAL for icon links in emails
We should not be using HTTP links for HTTPS-only sites.

Bug: T104835
Change-Id: I7dadeb29a8c5562c48d5beb2dd33818152c9eb63
2015-07-06 03:08:03 -07:00
Alex Monk 6b5a76939b chmod 644 a few files
Bug: T104721
Change-Id: Iee1ef18d3227807110d4e25f0c48f17907adf8ad
2015-07-03 19:31:15 +01:00
Kunal Mehta e536eab216 Avoid warnings on older queued EchoNotificationDeleteJobs
Old jobs were queued with array( $userId => $userId ), so there will be no
'0' index. Use array_values() since we don't care about the keys.

Change-Id: I1155d310c7fa09c728797d35d63c7cec0383511c
2015-07-02 15:08:14 -07: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
jenkins-bot dd2a9b0bbc Merge "Have EchoNotificationDeleteJob process only one user" 2015-06-17 12:32:07 +00:00
Kunal Mehta 25e32f1b3e Have EchoNotificationDeleteJob process only one user
EchoNotificationDeleteJob now only processes one user at a time. If
given multiple user ids, it will queue individual jobs for each user id
rather than processing many at once.

Bug: T102574
Change-Id: I627f059280d8fab3854d9ca8417f22179478772c
2015-06-17 00:22:42 -07:00
Kunal Mehta 1561725130 Remove EchoNotificationFormatter::requiredParameters
Instead, have subclasses implement checking required parameters
manually.

The only subclass that was using this was EchoBasicFormatter and has
been updated.

Change-Id: I23e2fa7044e0d59125530024f8c6c35516d3b90b
2015-06-16 15:32:12 -07:00
Kunal Mehta 89898043b1 Throw InvalidArgumentException in NotificationFormatter
Change-Id: I1417771c70ed644303ae22c43923cf9674835a7b
2015-06-15 19:28:48 -07:00
Kunal Mehta a2566e45a9 Don't silently accept invalid class names
Change-Id: I7888cd3356fcf7433a52455e1cf64522b7e17eb5
2015-06-15 19:26:31 -07:00
Kunal Mehta cac31dd843 Fix doc comment in EchoNotificationController
Change-Id: I3b82206f93099959ed3c12aed7853762cc3da8e4
2015-06-15 19:02:05 -07:00
Kunal Mehta da894d8a43 Fix docs on EchoNotificationDeleteJob and set explicit visibility on functions
Change-Id: I7bfa6b9a7c2a78135005d05024d77a3319c7eed0
2015-06-15 17:58:00 -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 df452abbb6 Don't hook into ourselves: EchoCreateNotificationComplete (part 1)
Change-Id: I5f0f3929a3b0396c98e0f3e74b69ddcee744a0e8
2015-06-15 17:41:10 -07:00
Matthew Flaschen 3c37aefdb1 Separate logic for extracting usernames from picking the right one
Pull out the logic that extracts usernames from links.  This allows
it to be reused by the LQT->Flow import code.

Bug: T101979
Change-Id: Ib16a09cf1f388f56944cd1bb564384535728156e
2015-06-12 21:16:59 -04:00
Matthias Mullie 4a9ebfc9a1 Guarantee a correct known status for Linker::link
Bug: T96162
Change-Id: I4b0962c5ca6bd09b34a8fa031e80b2274033ccc0
2015-06-11 11:15:33 -07:00
Kunal Mehta add1eb8266 Remove unused EchoDiscussionParser::getNotifiedUsersForComment()
Change-Id: I63c51835f54735c04f8356cf8ce161210895c378
2015-06-09 23:38:16 -04:00
jenkins-bot 46c8abdfd2 Merge "Merge MWDbEchoEmailBundler into MWEchoEmailBundler, remove abstraction layer" 2015-06-08 21:53:43 +00:00
Kunal Mehta 58b7cc7cfd Use intval() to make string concatenation in DB query less scary
Change-Id: I51d7744b8c7f967e47777b5f3a6e491f4e65f5c8
2015-06-08 14:36:08 -07:00
Kunal Mehta 07da9c2e41 Merge MWDbEchoEmailBundler into MWEchoEmailBundler, remove abstraction layer
Change-Id: Ifc05f1d03d1dde79d5c788ee7417ed0cec43155f
2015-06-08 11:58:06 -07:00
Kunal Mehta 24cd62e322 Merge MWDbEchoEmailBatch into MWEchoEmailBatch, remove abstraction layer
Change-Id: Ib1ae17326443d2143346bcd2e4204defa2dab4c3
2015-06-08 11:54:25 -07:00