Commit graph

227 commits

Author SHA1 Message Date
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
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
Stephane Bisson 5b72b9f026 Fix new talk page message notification
* Do not default section to footer. If the section
  is not found, it is left empty and the notification
  message is simpler.

* Change notification-edit-talk-page-email-batch-body2
  Replace : at the end with . so it does not look
  incomplete.

Bug: T99989
Change-Id: Ic982a81eada388d750760787245dea8f72368147
2015-06-03 13:17:57 -04:00
Kunal Mehta 9fd265d54b The job queue does not run against multiple wikis at once
...because that would be crazy.

Also fix return documentation.

Change-Id: I38c06767f4e53bafff19b4f0819158939ef264c0
2015-06-01 19:26:06 -07:00
jenkins-bot 956a3c608a Merge "Standardize doc spacing" 2015-06-01 19:26:23 +00:00
Matthew Flaschen 96c0bed332 Standardize doc spacing
Change-Id: I478da2a0ca37e42ad6a7af77082fa6f1ef61bade
2015-06-01 15:22:59 -04:00
Kunal Mehta e11fa6e094 Kill $wgEchoBackendName
All uses of $wgEchoBackendName were hardcoded to 'Db' and removed.

This exposed a interesting bug in MWEchoEmailBundler which was
instantiating a subclass using the parent class's private constructor, a
"feature" of PHP which is supported in 5.2.6+ (http://3v4l.org/h4Mq3).
While it worked, PHPStorm complained about it so I made the constructor
protected, which makes more sense anyways.

Both EmailBatch and EmailBundler need further refactoring, but that will
be done in follow up patches.

Change-Id: I2032f5b2f4f3a62f830cc5344b25a92074bd0c61
2015-06-01 12:13:11 -07:00
Stephane Bisson 3bfa823922 Maintenance script sends notifications immediately
Update the "processEchoEmailBatch" to allow sending all
notifications immediately even if configured to be
daily or weekly.

Change-Id: I6ebeea86708247700d1950e0f6471c7b3d1fecd2
2015-05-27 14:02:51 +02:00
Ori Livneh e79fb20599 Always assume a prefix-length of one.
Update Echo for I1bf1b8e6d: Make the output of UnifiedDiffFormatter match diff -u.

Change-Id: I00435a019753f639155df6572844c7112d717186
2015-05-26 04:32:00 +02:00
Aaron Schulz cad3f78d47 Removed pointless memcached delete()
Change-Id: If000119eb3f3c7acb5e337465958980192459074
2015-05-18 13:00:20 -07:00
Matthias Mullie 6bcece22cc Don't repopulate cache with potentially lagging DB data
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
2015-05-07 14:01:56 +02:00
jenkins-bot 07ba07d649 Merge "Add fallback for enotiftalk in generateEventsForRevision" 2015-05-01 20:49:16 +00:00
Matthias Mullie da07893647 Display red badge based on time of notifications vs last time panel was opened
I tried to stick as close to the existing code as possible.

Special:Notifications is slightly different from the overlay,
however. I made it add .mw-echo-unread class for consistency,
but that JS doesn't record seen time (it only loads older
entries), not does the CSS fadeout apply there (it marks
everything as read as soon as it's displayed, so different
behavior from overlay)

PS: I'm not sure about browser compat for the fadeout. But
even if some obscure browsers don't support this, meh. It's
not an "important" feature that can't be missed.

Bug: T94634
Change-Id: Ibb201823fb52ef8a3d5eaa39b0b724ede8d271d1
2015-05-01 11:39:45 -07:00
Federico Leva aa3d1afda3 Add fallback for enotiftalk in generateEventsForRevision
Link the bottom of the talk page and use the edit summary as text
if the parser failed to find something. This is what core's enotif
does already.

Change-Id: Iadc7011ea2627e00f0c51472da7aad1355afeddb
2015-04-26 15:52:57 +02:00
Federico Leva fd532b82ca More explicit type matching in detectSectionTitleAndText()
Change-Id: I22c8dc5235f8b4b531c5bbd3ec98c19df7f449a6
2015-04-26 15:37:59 +02:00
jenkins-bot 2625108d9e Merge "Remove unused default value" 2015-04-14 00:51:22 +00:00