Commit graph

662 commits

Author SHA1 Message Date
jenkins-bot 154725b90f Merge "Follow-up 9a1defa5: unbreak mention notifications" 2016-03-11 23:07:36 +00:00
Roan Kattouw e0581ecff3 Follow-up 9a1defa5: unbreak mention notifications
Actually pass the required User object to getTruncatedUsername().

Change-Id: I69ad0ea12d4b4785fbfeec801228cae518fd0a05
2016-03-11 22:57:20 +00:00
Moriel Schottlender 8657ef5e90 Allow mark-as-unread in notifications
Add a 'mark as unread' to all unread notifications and allow them
to be marked unread. These notifications will no longer be automatically
marked as read when the pages they refer to are visited.

Bug: T73564
Change-Id: I677d3c0399e46fd7c35531df1cc0e61db2d4eb1b
2016-03-11 14:05:10 -08:00
jenkins-bot 91a15811cb Merge "thank-you-edit: canRender for deleted page and extra fix" 2016-03-11 19:11:58 +00:00
Matthew Flaschen 07c962e82f thank-you-edit: canRender for deleted page and extra fix
Don't try to render if page was deleted, and fix 'extra' parameter
(was breaking message key and thus rendering)

Bug: T129641
Change-Id: I5d0fdfd3921427993211969eb5793f8e9e7667a8
2016-03-11 13:59:27 -05:00
jenkins-bot d796e84fa5 Merge "Clean up some code in EchoEmailBatch" 2016-03-11 17:31:54 +00:00
Roan Kattouw 933eecd2ec Follow-up 9a1defa: fix function name typo
Change-Id: I08466603a08496611ede9c0406d95c25a6a70e03
2016-03-10 19:53:34 -08:00
jenkins-bot 6fed475c40 Merge "Bidi isolate content items in notification header text" 2016-03-11 02:21:04 +00:00
Roan Kattouw 064a2cb5b8 Unconvolute DiscussionParser::getTextSnippet()
The previous implementation did the following weird things:
* Stripped tags before parsing
* Stripped templates before parsing using a hacky while loop
  that bails after ten attempts
* Decoded entities using htmlspecialchars_decode(), while
  html_entity_decode() makes more sense
* ...which meant it had to manually convert   back
  to spaces, which is not necessary if you use html_entity_decode()
* Removed any single braces ('{' and '}') from the output
* Rejected the entire output if there were any entities left,
  which is fairly likely since htmlspecialchars_decode()
  only decodes a few of them

Instead of all this, just parse, strip tags, decode entities
(all of them, not just a few), trim and truncate. In particular,
don't strip templates, because we use getTextSnippet() in mention
notifications, which look weird when {{ping}} templates are stripped.

Bug: T129531
Change-Id: I956b2f6badc40d2f5bf90a0458ccab8b8fc6fefb
2016-03-10 18:20:08 -08:00
jenkins-bot d22d779504 Merge "Call static Language::fetchLanguageName() statically" 2016-03-10 23:31:48 +00:00
Siebrand Mazeland 2d42463552 Call static Language::fetchLanguageName() statically
Change-Id: Ifbc00dcda36e72467165b8ee4bc002f5d2d76686
2016-03-11 00:12:14 +01:00
Moriel Schottlender 9a1defa57f Bidi isolate content items in notification header text
Bug: T127407
Change-Id: I25c426f3d0190bd33c4aa1c2ffb3c97fe1424567
2016-03-09 16:22:52 -08: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 210f3a1d4a Clean up some code in EchoEmailBatch
* Address TODO to use a constant instead of hardcoding
* Only call User::getOption() once

Change-Id: I52d8c3698f8d915ec9d96de0976d242009b3df39
2016-03-08 15:37:34 -08:00
jenkins-bot d1d8955825 Merge "Fix EchoAttributeManager::getNotificationSection() php doc" 2016-03-08 01:56:58 +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
Kunal Mehta d02b28d99c Fix EchoAttributeManager::getNotificationSection() php doc
Change-Id: I5a82e4618907e7a58a61d10ecb93c76d9772de53
2016-03-08 01:42:50 +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
Stephane Bisson ac556cf7c7 Notifications: truncate without adjust length
When $adjustLength is false, truncation will only happen
when the string is longer than the limit + the length of
the ellipsis to avoid the case where the ellipsis make
the string longer than the original.

Bug: T121822
Change-Id: I731a3c38b96ede6c6510f64771be0b9662dcba43
2016-03-03 09:08:10 -05:00
jenkins-bot 44902f0cb7 Merge "Add unreadfirst parameter that works in non-groupbysection mode" 2016-03-02 13:11:18 +00:00
jenkins-bot d596fe88e1 Merge "Move list of wiki names from header to body in cross-wiki notification item" 2016-03-02 08:56:39 +00:00
Roan Kattouw b6625f38af Add unreadfirst parameter that works in non-groupbysection mode
It's terrible that in groupbysection mode, you still have to pass
messageunreadfirst and alertunreadfirst separately, but at least
this way the unreadfirst feature is available at all in the
non-grouped mode.

Change-Id: Ifb0707be484bda8e33810c888bae1d008cac2d9f
2016-03-02 09:51:16 +01:00
Roan Kattouw 20f091982c Don't list foreign notifications for both sections when not using groupbysection
API requests with notgroupbysection disabled but notsection set
to 'alert' would return foreign notification bundles for both
alerts and messages, separately.

The frontend always pasess notgroupbysection=1 in practice because
notmessageunreadfirst=1 doesn't work without it; but regardless of
that, the API module shouldn't return a foreign notification bundle
for messages when only alerts are requested.

Change-Id: I9fa6d1411a8c121591ce6dd75ee8052bcdcb478b
2016-03-01 16:45:37 -08:00
Roan Kattouw c466a5ef5c Move list of wiki names from header to body in cross-wiki notification item
Using wiki names in the header is problematic because the messages
we were using weren't designed to be used in a sentence, only in headings.
This removes the wiki names from the sentence in the header, and
instead puts a comma-separated list (with "and") of wikis in the body.

The messages keep $3 and $4 for backwards compatibility, so translations
of the form "from Commons and 2 other wikis" will keep working.

Bug: T121936
Change-Id: Ideeba794e260b3c388fa29226b53197c050162ef
2016-03-01 10:10:29 -08:00
Roan Kattouw 08a3a92794 Bidi-embed user names and page names in secondary links
Bug: T127407
Change-Id: I50c0363aee2e1f985c5920f869f11675992ecb10
2016-02-29 12:53:42 -08:00
Roan Kattouw ff4a54d7f1 MentionPresentationModel: Remove pageLink from secondary links
It wasn't meant to be there, and flow-mention doesn't have it either.
We also don't have any other notification types with
three prioritized secondary links.

Bug: T125949
Change-Id: Icbffa185b1116b1a6beb9bb3585339fdf7e82cdd
2016-02-26 20:41:13 -05:00
Roan Kattouw ba27d4b8f6 ForeignNotifications::populate(): Fix max timestamp computation
We weren't using the maximum timestamp, just the most recently
encountered one.

Change-Id: Ie1cfd8130ab0c5077c4b720101d214d33e3ea9b4
2016-02-26 13:32:48 -08:00
Stephane Bisson 67facac67d Force notification body on a single line
The approach here is to use $msg->escaped() to
remove all markup and then replace new lines
with a single space.

Bug: T128062
Change-Id: I1d5a6e57fbae9b6a441671beff1c60720b9445d5
2016-02-26 07:00:38 -05:00
jenkins-bot cc87b9a35f Merge "Bidi-embed formatter user names (the $1 parameter) in notification messages" 2016-02-25 18:46:02 +00:00
jenkins-bot 04522752ed Merge "Notification: use speechBubbles icon for all talk pages" 2016-02-24 21:43:26 +00:00
Roan Kattouw e7cd68baf1 Bidi-embed formatter user names (the $1 parameter) in notification messages
Bug: T127407
Change-Id: I51fdbdfd0a706f21f36513b1e8beeeddffe8bec7
2016-02-24 13:34:53 -08:00
jenkins-bot 656d6c401c Merge "Handle null user when trying to generate a link for notifications" 2016-02-24 21:29:25 +00:00
Stephane Bisson 3e028b8b1d Add 'Log' link to user-rights notification
Bug: T127249
Change-Id: I0ee20fefa2241d2858e6473bb709dce9519b82d4
2016-02-24 13:23:34 -05:00
Stephane Bisson f1e68f9451 Handle null user when trying to generate a link for notifications
Bug: T127728
Change-Id: I87de2d10887216e3edf53c2972b6bf230191f0ea
2016-02-24 11:42:03 -05:00
jenkins-bot 701f684eee Merge "Delete rows in echo_unread_wikis if there are no unread notifs" 2016-02-23 21:18:12 +00:00
jenkins-bot ac952bf5e8 Merge "Add GENDER support to 'View changes'" 2016-02-23 20:45:35 +00:00
jenkins-bot 92d0d4c533 Merge "Echo API returns absolute URLs in notification links" 2016-02-23 18:02:40 +00:00
Stephane Bisson a73d63d1a4 Echo API returns absolute URLs in notification links
Some notifications return relative urls in their
primary or secondary links. This change makes those
urls absolute so they point to the right wiki
when viewed from another wiki (cross-wiki notifications).

Bug: T125738
Bug: T127697
Change-Id: Ib65337430eb2484f9491668a9998deef70589fb1
2016-02-23 17:54:26 +00:00
Matthias Mullie 4715b55471 Add GENDER support to 'View changes'
Change-Id: I42b8b253b8b865c081ba1aec62848afadd21e0f4
2016-02-23 17:56:16 +01:00
Matthias Mullie 6be71f2fae Delete rows in echo_unread_wikis if there are no unread notifs
It used to be like this, but in order to get the messages badge to show
in the correct circumstances, I had to know if the user had ever had
foreign messages before & I also needed euw_messages_ts even if those
messages had already been read.

Now that we're unconditionally showing messages, we no longer need these
0-value rows.

Bug: T127731
Change-Id: I1fc13bf0e5133ae39224f66d1b5a59c769bfcee2
2016-02-23 16:21:28 +01:00
Stephane Bisson 860404eded Notification: use speechBubbles icon for all talk pages
Bug: T56433
Change-Id: I14e1af9dda1c08e1526fde59072f93189ab0b0d0
2016-02-23 06:53:55 -05: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
Matthias Mullie 3979919087 Display human-readable wiki names for cross-wiki notifications
Bug: T121936
Change-Id: Ic14fe65f4ecc6db94fc6774ca0c39d1c2a47db9d
2016-02-22 20:09:53 +01:00
jenkins-bot 75282786fd Merge "Fix hasMessages result when inconsistently enabling cross-wiki" 2016-02-19 20:09:25 +00:00
Matthias Mullie 9f203c560f Fix hasMessages result when inconsistently enabling cross-wiki
Current situation: cross-wiki can be enabled on certain wikis &
disabled on others.
Code used to check if cross-wiki was enabled before fetching the
status of unread messages on foreign wikis. However, it would then
write that result to a shared memcached key.

The cross-wiki check should not happen before data is stored to
cache: what is stored should always be for all wikis. Only when
we fetch it, should we check if cross-wiki is enabled. And if it's
not, we can't use the cross-wiki data - we have to hack around it
ourselves...

Bug: T124372
Change-Id: I3d3d54fc3cbfbf73b51e97acfd8d355dd0cea36d
2016-02-19 11:37:16 -08:00
Matthew Flaschen 4b316438a5 Fix 'Undefined index' PHP warning so XDebug doesn't complain
Change-Id: Id8f8113bcdc454d5df09a20175c7698791b71fba
2016-02-19 05:09:45 +00:00
Stephane Bisson 7dc87b9f7a Allow setting the unread counts to 0 in the echo_unread_wikis
Bug: T127331
Change-Id: I90342c9d64277faa77a905b227148d3102d049cb
2016-02-18 15:31:55 -05:00
Stephane Bisson 74879c39fb Truncate secondary link labels
Bug: T121822
Change-Id: I3e36a6cd4bc8da96879158e1d7b65fd3a1d582fb
2016-02-18 06:55:36 -05:00
jenkins-bot d1830041af Merge "Include reason in user-rights notification body" 2016-02-16 17:59:12 +00:00
Stephane Bisson dff7e8072b Include reason in user-rights notification body
Bug: T126277
Depends-On: Ib9bb28a7a77602e3e729fd0bf13ab8259e15b006
Change-Id: I4941c4ba16ee95798767d858792090609b47b4e4
2016-02-16 01:51:07 +00:00
Stephane Bisson 98861d059a Truncate section names to 50 char
Bug: T121822
Change-Id: I6220fdfb2ad20cfe9935895a2f5a16727d6cbc01
2016-02-15 15:59:00 -05:00
jenkins-bot 2bf38f6c37 Merge "Get rid of pre-5.4 CallbackFilterIterator implementation" 2016-02-13 07:25:50 +00:00
jenkins-bot 33ee3ebf80 Merge "Have EventPresentationModel implement JsonSerializable" 2016-02-13 07:23:50 +00:00
Kunal Mehta 92f69106cd Get rid of pre-5.4 CallbackFilterIterator implementation
Change-Id: Ie2e26eeb9d819db0353e446a7dcd87a809992d92
2016-02-12 14:20:16 -08:00
jenkins-bot 5019802f29 Merge "Introduce congratulatory notifications for reaching edit thresholds" 2016-02-12 22:19:04 +00:00
Kunal Mehta 7f981670a3 Have EventPresentationModel implement JsonSerializable
Change-Id: I25a9ba9371ccf6c246de21fbb2c880441e051090
2016-02-12 14:15:23 -08:00
James D. Forrester 5031539327 Introduce congratulatory notifications for reaching edit thresholds
Bug: T124003
Change-Id: I21c6570e178fd03d969a516bdb31a6da9735d242
2016-02-12 14:11:21 -08:00
Stephane Bisson 09928f1ed2 Add email body preview to emailuser notification
when the subject line is left with the default
generated value, we take the begining of the
email content to add a preview in the
notification.

Bug: T121831
Change-Id: Ib7c646f6709c7100ef51186f84fe14807d6a211a
2016-02-12 14:50:17 -05:00
jenkins-bot 202afb8227 Merge "Truncate usernames to 20 char in notifications" 2016-02-11 19:02:21 +00:00
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
jenkins-bot f0ca5a5f0d Merge "If user only has foreign messages, the messages badge should not be suppressed" 2016-02-10 21:02:15 +00:00
Stephane Bisson 442f812774 Add subject to email notification body
Bug: T121831
Change-Id: Ib1a9212202d2c84de8d968d043f65e24b2d94fae
2016-02-10 12:34:26 -05:00
Matthias Mullie b9f2d026a6 If user only has foreign messages, the messages badge should not be suppressed
Bug: T124372
Change-Id: Id9699c56e9b8c6af77e74cbfc48b6e4e3464b3a5
2016-02-10 13:25:50 +01:00
Stephane Bisson 961968ff56 Truncate usernames to 20 char in notifications
Bug: T121822
Change-Id: Ie9650b5c72f2224dc6d26b3bfc45f29cbbd23397
2016-02-09 13:46:39 -05:00
jenkins-bot ccebb42186 Merge "Get rid of old flyout formatter code" 2016-02-09 18:34:36 +00:00
jenkins-bot f9b8202f4f Merge "Use current HTML formatter (for special page) instead of previous" 2016-02-09 18:22:33 +00:00
Stephane Bisson f7b0637d59 Fix 'user-rights' notification messages
Bug: T121661
Change-Id: I5b73001f2f748a39c3b28f6b571f076a51f8f785
2016-02-08 08:45:10 -05:00
Matthias Mullie 9fe71a1182 Get rid of old flyout formatter code
This code is completely useless:
* for format=flyout, the new EchoFlyoutFormatter.php will be run
* and even that one has already been deprecated as it was replaced
  by format=model (flyout html is now built in client)

Change-Id: Iea23abb66397ecc4efb575fe33fdbedc5b4e0f70
2016-02-05 06:56:15 +00:00
Matthias Mullie 1be7039660 Use current HTML formatter (for special page) instead of previous
The existing "html" formatter was used for the special page & is now
superseeded by the new-style "special" formatter. Previous "html"
notifications are no longer used & could even be broken.
Instead of keeping the old "html" formatter around, we should let it
use the new formatter (and eventually just kill that redundant format
in the API)

Change-Id: Ibbd40aafa9eee718b196ad62f6edc99629b263b4
2016-02-04 20:03:19 +00:00
Matthias Mullie 4f097b02d0 Get rid of $legacyMapping
We now have 'special' in $formatters, there's no need to keep
the mapping to the legacy formatter around.

Change-Id: I66f330e8c84a50858658361caef521a3e5717d58
2016-02-04 19:57:06 +00:00
jenkins-bot d5ec5d0d92 Merge "Deprecate ApiEchoNotifications.php format params flyout & html" 2016-02-04 19:55:34 +00:00
Matthias Mullie c94c8abb53 Deprecate ApiEchoNotifications.php format params flyout & html
Change-Id: Ib1db9dbec7a0980b10ba4dc1b3f62ea468437390
2016-02-04 12:38:19 +00: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
Stephane Bisson ffc4365b08 Make sure to use array_values for group names in user-rights notifications
Bug: T125279
Change-Id: I49b5fe5cf27aef5b710a5d95a064b09b08612667
2016-02-01 13:30:25 -05:00
jenkins-bot 59fc1b6f85 Merge "Add snippet to mention notification" 2016-02-01 09:10:05 +00:00
Stephane Bisson a4b91ebef8 Gender support for viewing user in user-rights notifications
Bug: T125251
Change-Id: Iadd341a3bb555c91152528bbddaf2a660b8dcc77
2016-01-29 16:07:39 -05:00
jenkins-bot 44ae5aefae Merge "Support GENDER in mention-on-user-talk messages" 2016-01-29 16:47:23 +00:00
jenkins-bot e750abdf43 Merge "Fix lego messages in 'user-rights' notification" 2016-01-29 16:30:06 +00:00
Stephane Bisson 475d724b45 Support GENDER in mention-on-user-talk messages
Also refactored getHeaderMessageKey for grep-ability

Bug: T56433
Change-Id: Ia844c3e0008c7ed24dcc093e3eab41decbcaeb2a
2016-01-29 11:19:12 -05:00
Stephane Bisson 779b7030d9 Truncate usernames, titles and excerpts in notifications
Bug: T121822
Change-Id: Ia0a52926133ab7e04d7d9c2a095ef8f9d0871a49
2016-01-29 07:04:23 -05:00
Stephane Bisson cd7edf0378 Rephrase mention notifications
Split mentions into 4 cases:
 - Mentioned on article talk page
 - Mentioned on agent's talk page
 - Mentioned on another user's talk page
 - Mentioned on any other page

Adjust secondary link
  icon: article or talk
  text: without namespace for article and article talk

Bug: T56433
Change-Id: Ibf965dad4f9cc468fdd4321b2450d6eaec0ac1d7
2016-01-29 07:04:23 -05:00
Stephane Bisson 2c7136ecb7 Fix lego messages in 'user-rights' notification
Bug: T121661
Change-Id: I8386429a36182dbc44b45990506a42cbeef115ad
2016-01-28 11:43:04 -05:00
Bryan Davis 3f7436c959 Wrap CallbackFilterIterator in a condition check
Wrap the CallbackFilterIterator backport class in a conditional check
for PHP runtimes that include the class natively. This really should
only be needed for linting as the class is loaded via an autoloader
and thus should not be loaded if the runtime already has it
available.

Bug: T124828
Change-Id: I39d27385186d4693a8babdd2b818e6b4bc16255a
2016-01-26 14:57:18 -07:00
Stephane Bisson 386bc86233 Add snippet to mention notification
Bug: T121817
Change-Id: I9a77d8ecb1b91f6a196f17777cfabf97c0b59da7
2016-01-21 10:19:14 -05:00
Reedy 085d6fe3a1 Call UserMailer::send() with reply to address correctly
Change-Id: I240c61a154af591e852cd9ddc537365bc22d2855
2016-01-21 01:02:05 +00:00
Roan Kattouw 119af0e09a Make the mention notification actually link to the right section
getLocalURL() does not take the fragment into account.

Bug: T123847
Change-Id: I4f8b11c1693ebfcdae69f001057f5db15c11b94f
2016-01-19 09:35:26 -08:00
Justin Du 67d8394cd0 Deprecated use of 5th parameter in UserMailer::send
*In EmailBatch.php line 287

Bug: T123641
Change-Id: I7f75448b0f6839c6d104eedca0f0c2f7d0780337
2016-01-18 21:19:42 +00:00
Stephane Bisson 9e536c91d4 Rephrase Echo 'edit-user-talk' notification
Bug: T123934
Change-Id: If053f9787127ca4488c51a663000a48bc717cadf
2016-01-18 15:44:18 -05:00
jenkins-bot 238097e364 Merge "Use globe icon for cross-wiki bundle" 2016-01-18 20:28:53 +00:00
jenkins-bot 18bffba313 Merge "Display revert edit summary in revert notification body" 2016-01-18 19:46:49 +00:00
Stephane Bisson d7d70a06a1 Display revert edit summary in revert notification body
Only display when it's different than the pre-populated
edit summary (Undo revision 123 by User).

Bug: T121808
Change-Id: I5a00ff174fd31fdbf776a06b7b9375f63b921677
2016-01-18 10:14:15 -05:00
Matthias Mullie e7e55d4279 EchoModelFormatter extends EchoEventFormatter
There was no point in letting it extend EchoFlyoutFormatter instead
of the base EchoEventFormatter. The only things in EchoFlyoutFormatter
are formatModel & getIconURL, both of which aren't being called.

Change-Id: I89511530a41976974f4d51d55379a617dfe503ec
2016-01-17 22:26:34 -08:00
Roan Kattouw 3c543215aa Use globe icon for cross-wiki bundle
Bug: T123757
Change-Id: Ib97c0abb43aacba19e6b8d8a329c836e332927a2
2016-01-15 16:43:14 -08:00
jenkins-bot cb1041f5e1 Merge "Add icon to "View changes" secondary links" 2016-01-15 20:43:13 +00:00
Roan Kattouw e22ca687dc Actually respect notnoforn parameter
The parameter was added, but it wasn't looked at by any code at all.

Change-Id: Ib6b13e520621ad7c230a297ebae61d6a16dce57a
2016-01-15 09:47:12 -08:00
Roan Kattouw c345bef598 Add icon to "View changes" secondary links
Bug: T121736
Change-Id: I7dda877c26c99392c17702265380f4ea2a6e8049
2016-01-14 22:53:51 -08:00
Roan Kattouw e55754857c Work around $wgConf's uselessness
WikiMap is almost useful for this purpose, but not quite
because it doesn't provide the script path, only the article path.

Change-Id: I1627d58cab5ff518be3c3e14e05a53899b083503
2016-01-14 21:28:02 -08:00
jenkins-bot 33fe9a0038 Merge "Cross-wiki notifications integration" 2016-01-15 01:15:42 +00:00
jenkins-bot 2eed540186 Merge "Clarify some notification icons" 2016-01-13 22:53:27 +00:00
Justin Du 7d2a15d3bc Clarify some notification icons
* edit-user-talk
* mention
* user-rights
* emailuser

Bug: T121735
Change-Id: I72e382b9ff9d19c6acc0df507fdff65732b66450
2016-01-13 14:00:37 -08:00
Roan Kattouw 63eef35026 Cross-wiki notifications integration
Bug: T121829
Change-Id: Ifb52ad5605a56d27e5951479326689242a49430e
2016-01-13 09:47:57 -08:00
Kunal Mehta 4cd9aca385 Move Notifier.php to includes/
Change-Id: Iae4ca71a5e25eb70b9fece94052b29eeb79d7a1e
2016-01-13 09:25:22 -08:00
Matthias Mullie 72f687730f Get link of LinkNormalizer
All extensions seem to have been updated to use the current formats,
so we can get rid of this tech debt.

Depends-On: I7503db28b0d81fb818b525ea9362e49b9b56342a
Change-Id: Idbcbbf95eab1172015bceea4e8124ba4c639efa8
2016-01-12 21:56:52 +00:00
Matthias Mullie 2d72a0e748 Be more clear about what data types we expect in links array
Also updated description value in agent link: '' is used everywhere
else to mean "no description" (because that's exactly what '' is)

Change-Id: Ib77c0f1843593abf67e9d726a80bb4fbe1ec7d84
2016-01-12 13:50:43 -08:00
Stephane Bisson 60ddc76880 Update page-linked notification text
Bug: T121812
Change-Id: Ie875f105230c8364291a918b869b9c26dbdf1e83
2016-01-12 10:11:31 -08:00
jenkins-bot a29c62065c Merge "Add agent link to most notifications" 2016-01-11 22:46:41 +00:00
Stephane Bisson 421ba29a2f Add agent link to most notifications
Affected notifications are
  - edit-user-talk
  - email-user
  - mention
  - reverted
  - user-rights

Bug: T121737
Change-Id: I826cc6088b4f9c1aaef9e8adee0566d25982ed47
2016-01-11 14:34:39 -08:00
Kunal Mehta 7f0dafbe73 Don't parse wikitext in edit-user-talk snippets
Bug: T121994
Change-Id: I427def99f2773896feabaf6202e7f4eecd850be1
2016-01-08 09:22:20 -08:00
jenkins-bot 1ca53fe96a Merge "Fix casing of Whatlinkshere in page-linked presentation model" 2015-12-23 18:54:17 +00:00
Stephane Bisson 1eccdbcb49 Fix casing of Whatlinkshere in page-linked presentation model
It generates an annoying orange notice.

Change-Id: Ia548cd08e66db8ab381052874f21ccc49fb03981
2015-12-23 13:04:38 -05:00
jenkins-bot 7858d06537 Merge "Use UTC timestamps in flyout" 2015-12-23 15:48:16 +00:00
jenkins-bot 34ab32507a Merge "Replace EchoBatchRowUpdate with BatchRowUpdate" 2015-12-22 23:32:42 +00:00
Matthias Mullie 089d922ac7 Use UTC timestamps in flyout
We already output unix timestamp both in user preference timezone as well as
utc, but we only had the user timezone version for TS_MW format.
While we could change the frontend to use the unix timestamp format, I don't see
any reason not to also include the MW format in utc. Frontend can now easily use
that.

Also fixed creation of the moment object. The timestamp was created as UTC, but
the way it got there was wrong: it expects the timezone offset (Z) to be
included in the timestamp, which is not the case (so it just ended up at +0:00,
which was fine, but confusing). I removed the 'Z' and forced it to be
interpreted as utc.

Bug: T121813
Change-Id: I09403615a1ffbde5dd69af9914afdbdd86cbfe4d
2015-12-22 17:07:31 +01:00
jenkins-bot 60cd07bbd3 Merge "Add mw-echo-payload class to body in Special:Notifications as well" 2015-12-19 10:16:21 +00:00
Roan Kattouw aef3050207 Add mw-echo-payload class to body in Special:Notifications as well
This was already done earlier in the old flyout formatter.

Change-Id: I3b4029de4c76910e139d02c9b93cf50e0fac0236
2015-12-18 12:56:32 -08:00
Roan Kattouw f52e653d5d Remove link from mention notification header
We're trying to get rid of links in notification
messages, and the link was redundant with the primary link
in both cases.

Change-Id: I69e888a355c263b5a8c5ca7a46430746895de44c
2015-12-17 15:01:01 -08:00
jenkins-bot ea7e2f87b6 Merge "Use current (with keys) array format for primary & secondary links" 2015-12-16 18:49:07 +00:00
jenkins-bot d340ed2100 Merge "Add filter to ApiEchoNotifications" 2015-12-16 18:49:04 +00:00
Matthias Mullie 3f65ed519f Use current (with keys) array format for primary & secondary links
They're currently auto-converted to the new format, but ideally,
we wouldn't need that B/C code. And since this is the extension
others will likely look at for examples when implementing, we
should do it right here.

Also: there is no B/C correction for missing keys in secondary
links (description, icon).

Change-Id: If1a8b9911e81bb4c565f21a4b9e31fdc73426d93
2015-12-16 17:52:04 +01:00
Geoffrey Mon 13948c949f Replace EchoBatchRowUpdate with BatchRowUpdate
Also removes tests for the class.

Bug: T119253
Change-Id: I4c0d7187c2b847297dd0867faecba26185cfba37
Depends-On: Iccafbbdb06711463fee0f30a11326c7771df30e2
2015-12-16 16:36:59 +00:00
jenkins-bot 95290e8a4e Merge "Also support continuation requests for $unreadFirst" 2015-12-15 17:32:17 +00:00
Kunal Mehta 8ede0bf20d Add missing @throws tag and change Exception subclass being thrown
Change-Id: I39e3cdbdf4bddc12ca2d7d6a2696b92b8b7cbd10
2015-12-14 10:41:54 -08:00
Matthias Mullie f8a483d1f8 Add filter to ApiEchoNotifications
It lets you query for read/unread/all notifications.

Bug: T119890
Change-Id: I5d09b5ff9474c77577734e9ceb0bcbcad6c99c0c
2015-12-14 17:29:52 +01:00
Thiemo Mättig 66d5e17a25 Fix broken and incomplete PHPDoc tags
Change-Id: I0c8928a2dbf67cb15841fae6cc55c363357ec265
2015-12-14 11:03:09 +01:00
Kunal Mehta cfdc6cb3d0 Unbreak notformat=text|html in the API
Just pass any unknown formats through.

Change-Id: I156b49a959b5453cd37cd4c3d58652b5420132f3
2015-12-10 15:23:57 -08:00
jenkins-bot ade37b5925 Merge "Share code between EchoNotificationMapper::fetchByUser & fetchUnreadByUser" 2015-12-10 19:16:17 +00:00
Matthias Mullie 55cc28dd81 Also support continuation requests for $unreadFirst
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
2015-12-10 17:33:32 +01:00
Matthias Mullie 2a1abc0281 Share code between EchoNotificationMapper::fetchByUser & fetchUnreadByUser
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
2015-12-10 17:19:46 +01:00
Stephane Bisson 04d4da2783 Presentation model for edit-user-talk
Bug: T116843
Change-Id: Ia11f5b57747ed0be5d4b00c75925d5fcdde87c43
2015-12-09 13:35:10 -05:00
jenkins-bot 47fd3b5896 Merge "Presentation model for page-linked" 2015-12-09 18:02:15 +00:00
Kunal Mehta 999c53a1c3 Use CentralIdLookup instead of hardcoding for CentralAuth
Change-Id: I5b2d23588ab6b026d1a2100b9c16a74e9aefbd73
2015-12-08 16:54:23 -08:00
mhutti1 ea64fe4770 Redirect anonymous user to login page from Special:Notifications
Added code to redirect the user and display a short message informing
them of the need to login.

Bug: T118873
Change-Id: I2145bc1502dbd19d660302d9f19e0d4a2ad5ad50
2015-12-08 11:55:15 -08:00
Stephane Bisson a9f307ceab Presentation model for page-linked
Bug: T116843
Change-Id: Id9894b98a0dd7554a529ff763aaf0f719e36152b
2015-12-08 14:02:19 -05:00
Roan Kattouw ece6e3f80a Follow-up 65638384: update calls to normalizer functions
Change-Id: Id6352b133e88827047dac85423b6914b83e71909
2015-12-07 16:49:24 -08:00
Stephane Bisson 14b842bd34 Add gender support for the viewing user for mention notification
Bug: T119321
Change-Id: I1cd7caa7bfe811bab89a0c6950c1aeaf1739aac6
2015-12-04 16:53:11 -05:00
Stephane Bisson 65638384fc Normalize links in Special:Notifications formatter
Change-Id: I35354a3b27a59ee9740c6330bb3df22a8f7d6093
2015-12-03 11:11:15 -05:00
Roan Kattouw 52f4b91204 Allow grouping for getBundleCount()
Presentation models that display the number of bundled notifications
typically group these by a property like agent or page ID. For example,
every edit someone makes to a user talk page generates an event,
so there could be 5 edit-user-talk events by only 2 distinct users;
in that case we want to display "Foo and 1 other user left a message",
not "Foo and 4 other users".

With this change, a presentation model that wants such behavior
can pass a callback to getBundleCount() that retursn the user ID, which
will cause getBundleCount() to return the number of distinct
users rather than the total number of notifications.

Change-Id: I79c8dd14277eff0d2ec27f155b1d13dca1e571a8
2015-12-02 08:16:19 -08:00
jenkins-bot 434a034120 Merge "Special:Notifications formatter" 2015-11-30 21:30:05 +00:00
Stephane Bisson 259effc235 Get bundled notifications count
Utility functions to get the count of bundled notifications
for display and plural purposes.

Change-Id: I74d5ad244dec337a94e59c2118c33e474cd76797
2015-11-27 14:28:35 -05:00
jenkins-bot a8171d1f75 Merge "EventPresentationModel: Cache the result of getBundledEvents()" 2015-11-25 18:39:01 +00:00
Roan Kattouw 104075d2d4 EventPresentationModel: Cache the result of getBundledEvents()
Change-Id: I83ce3b7754055dd494fcde41f043144294da2f3f
2015-11-25 10:33:47 -08:00
Kunal Mehta 2892108b65 Special:Notifications formatter
I'm not really sure where to stick the primary link. I could wrap the
entire notification in a <a> tag, but all the text becomes ugly (I
suppose we could hack around it with CSS?). For now I just added it
before all the secondary links.

Change-Id: I4f6add9ecfb367660d1a6346825382ad415bdb77
2015-11-25 10:22:04 -08:00
Roan Kattouw 23734e3539 Follow-up b85f978ddd: don't check for the non-existent CentralAuth class
Change-Id: Ie7ca022c659f9856641aaec6183eadf8a86865a2
2015-11-24 19:34:27 -08:00
jenkins-bot cdee3093b3 Merge "Add secondary link details: icon & description" 2015-11-24 18:54:15 +00: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
jenkins-bot 6eba89d400 Merge "Add accessor for bundled events in EventPresentationModel" 2015-11-23 23:43:41 +00:00
Kunal Mehta 9057196d21 Add accessor for bundled events in EventPresentationModel
The implementation of this sucks as the presentation model
should not be making database queries. But the API it provides
is what we want and will be supported even if the backend
implementation is changed.

Change-Id: Ifd0d11260990fd0e00e8f32eee273f9717d3e1fb
2015-11-23 15:13:31 -08:00
Matthias Mullie 30dcfeaa9e Add secondary link details: icon & description
We should probably merge this ASAP now that a lot of presentation
models still have to be implemented. There's a bit of B/C code that
will take care of the previous format, but it would be nice to be
able to remove that soon.

Meanwhile I've also changed getPrimaryLink to follow the same format.

Bug: T115421
Change-Id: Ic18a050d2ee0239f287a6d55c572df6f8aebb59a
2015-11-23 16:10:52 +00:00
jenkins-bot f875dfc191 Merge "Track what wikis a user has unread notifications on" 2015-11-21 00:05:44 +00:00
Kunal Mehta b85f978ddd Track what wikis a user has unread notifications on
This implements a backend layer and database storage for tracking what
wikis a user has unread notifications on. It is not yet exposed via any
API.

Whenever the notification counts on the local wiki are reset, a deferred
update is queued to also update the central database table.

Change-Id: Id1498bdeb5811d6848dc66781ffca03e726eab90
2015-11-20 15:54:11 -08:00
jenkins-bot 0416f39e68 Merge "Expose more data through API" 2015-11-20 23:41:55 +00:00
jenkins-bot 7a68a05083 Merge "Prevent link color on hover for the body ("payload") as well as the header" 2015-11-20 23:39:37 +00:00
Matthias Mullie 0ef4df8e15 Expose more data through API
Instead of relying on the frontend to render, this enables the frontend
to do it.

The API will now accept a new format: 'model', which is basically the
presentation model's data in json format.

Some of the render code is currently only in the backend (e.g. get icon
path from icon type) so other api formats will stay available. At some
point, however, we may be able to kill those.

Bug: T115418
Change-Id: Ibc3ad54c94d6ea9bf751f3927cf69e1d062f4780
2015-11-20 19:27:34 +00:00
Kunal Mehta 8c49a812e1 Unstub $wgLang in BasicFormatter::getLanguage() too
Bug: T118542
Change-Id: Ic9f3c03a3f1d38f2ea420cf32dcd3bb33d6c3635
2015-11-19 16:34:13 -08:00
Kunal Mehta a00628b42a EventMapper::fetchByUserBundleHash(): Always return an array
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
2015-11-19 10:12:43 -08:00
Roan Kattouw c8d0115fd5 Prevent link color on hover for the body ("payload") as well as the header
Change-Id: Id221af75ed76122b03f741c184053e73bd2f4ee5
2015-11-18 20:10:40 -08:00
jenkins-bot 904e1e5a8c Merge "Presentation model for reverted" 2015-11-19 00:55:46 +00:00
jenkins-bot 9c40143cef Merge "Presentation model for email-user" 2015-11-18 18:42:00 +00:00
jenkins-bot 5100bba74f Merge "Extract getMessageWithAgent" 2015-11-18 17:53:03 +00:00
Stephane Bisson b3ab132ffd Extract getMessageWithAgent
`getMessageWithAgent` is used by `getHeaderMessage` is can
be reused by other presentation models who need the
agent in their body message.

Bug: T118059
Change-Id: I0cbccaeb8b6e60d03bc75bc85c74591619b4399a
2015-11-18 09:47:24 -08:00
Matthias Mullie a35bf21084 'Load more' check should be based on retrieved data, not what could render
Since EchoEventPresentationModel::canRender can reject notifications,
its result should no longer be used for infinite scroll.

Current code checks if the amount of to-be-rendered data exceeds what
we need to display, but if we reject some notifications that may no
longer be the case, even though there is more data still.

Change-Id: I3e5f8c2d1fc0c63db7b277324c96af043689ddce
2015-11-18 11:06:22 +01:00
Stephane Bisson 44149b6cbd Presentation model for email-user
Bug: T116843
Change-Id: I99e790d72c7c534665d1d86c38459c5d0e60b91b
2015-11-17 12:44:45 -05:00
Stephane Bisson 3fa832c6c7 Presentation model for reverted
Bug: T116843
Change-Id: Ide03220ad8ad621b5943e36d71e484a21bc8a65b
2015-11-17 10:19:15 -05:00
Kunal Mehta dbc83a0c0c Unstub $wgLang before passing it to DiscussionParser::getTextSnippet()
getTextSnippet() has a `Language` type hint that will fatal if $wgLang
is a StubUserLang object, so make sure we unstub it if nothing else
already has.

Bug: T118542
Change-Id: I847680074fbbf95bbe3b6002151d2a18c45ebe6e
2015-11-16 10:41:51 -08:00
jenkins-bot 72cb6202b0 Merge "EventPresentationModel: Add accessor for current user's username" 2015-11-12 23:58:10 +00:00
jenkins-bot 20579a711b Merge "Allow welcome notifications to have a primary link" 2015-11-12 23:53:08 +00:00
jenkins-bot b36847f95f Merge "Fix some phpdoc, add missing @throws" 2015-11-12 23:52:06 +00:00
Kunal Mehta 40667ca7d4 EventPresentationModel: Add accessor for current user's username
Only to be used for GENDER purposes.

Bug: T118058
Change-Id: I5cf0563374ac1eaf934fecbf4bb68d35fa287edd
2015-11-12 14:34:24 -08:00
Kunal Mehta 0a0a62e3c3 Allow welcome notifications to have a primary link
Wikis can customize the 'notification-welcome-link' to a page title
(like "Project:Welcome" for example) and the "Welcome!" notification new
users receive will have a primary link to that page.

Bug: T117509
Change-Id: I29f6d69db480fa7d39573941e762c4dad8737ed0
2015-11-12 14:30:51 -08:00
Kunal Mehta fb56d61d68 Fix some phpdoc, add missing @throws
Change-Id: Iba072d64443ed9117233f591f1aea3cc6a4adc44
2015-11-12 14:10:52 -08:00
Kunal Mehta 5114aa2c26 Remove unused NotifUser::getFormattedNotificationCount()
As of 0790125dd4, this is unused.

Change-Id: I7d7080cd2c45c14a3fb59fc3b9d224fac8e55dd8
2015-11-12 11:21:56 -08:00
jenkins-bot 1619c87109 Merge "Make EchoEvent::create() a no-op if the DB is read-only" 2015-11-06 18:22:24 +00:00
Stephane Bisson 7e1a6e7b6f Output body in flyout
* Also rename getBodyText to getBodyMessage
  since it returns a Message.

Change-Id: I2aad6f766407c13625b1c35df3ae209f75849970
2015-11-04 16:24:37 -05:00
jenkins-bot bc4888169d Merge "Add a presentation model for Echo "Welcome" notification" 2015-11-04 18:34:33 +00:00
Timo Tijhof 59e1be5af9 Migrate LocalCache from MapCacheLRU to HashBagOStuff
Depends on If39d72983 for HashBagOStuff::clear().

Change-Id: I90a03ea44430223ef420be9175bea9bcc8da8cf5
2015-11-03 06:49:50 +00:00
Timo Tijhof b99048e9aa LocalCache: Fix bad type hint of getTargets()
Change-Id: Ib05064b6d812b89948f7927caa6a6bf5634a6a08
2015-11-03 06:02:31 +00:00
Moriel Schottlender 88b558f44d Add a presentation model for Echo "Welcome" notification
Bug: T116843
Change-Id: Ia43ce2c467873390c2b36439af1db8932708cda9
2015-11-02 16:02:06 -08:00
Kunal Mehta 38e54e14fb Allow notifications to not have a primary link
Because 'welcome' doesn't.

Returning `false` indicates that there is no link, and the
FlyoutFormatter was updated accordingly.

Change-Id: Ifd329b396f3361fc7c08c607a6407181ffdb8bf6
2015-11-02 15:55: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
Kunal Mehta 558cc64bc2 IDatabase::delete() does not take a fourth parameter
And don't use the deprecated getDB() function.

Change-Id: I824fb1e69262298d6b76fb22b499d961c1189f98
2015-10-30 10:49:59 -07:00
Kunal Mehta 74b50cad30 Move some boilerplate code into EchoEventFormatter
The conversion of EchoEvent into a EchoEventPresentationModel is now
done by EchoFlyoutFormatter, instead of having each subclass do it. It
also does the canRender() check so subclasses don't need to worry about
it.

The subclasses no longer have access to the underlying EchoEvent object,
so the timestamp is exposed in EchoEventPresentationModel.

Change-Id: I7f0a650373eebac7aa2231b1795b51a6d031ad67
2015-10-29 21:22:54 +00:00
jenkins-bot 5b74ffce63 Merge "build: Enable phpcs rule 'MediaWiki.VariableAnalysis.UnusedGlobalVariables' and make pass" 2015-10-29 17:40:49 +00:00
jenkins-bot f7ffecf3d8 Merge "build: Enable phpcs rule 'MediaWiki.WhiteSpace.SpaceAfterControlStructure.Incorrect' and make pass" 2015-10-29 17:39:48 +00:00
jenkins-bot 0442658bf3 Merge "Document that text from getSecondaryLinks() isn't escaped" 2015-10-29 17:33:20 +00:00
jenkins-bot a40ed3d4ca Merge "Fix @return doc on EchoEventPresentationModel::getPrimaryLink()" 2015-10-29 17:33:18 +00:00
James D. Forrester 1e01328018 build: Enable phpcs rule 'MediaWiki.VariableAnalysis.UnusedGlobalVariables' and make pass
Change-Id: I1af3e34531ff9d02183a7ad0052712d9f137609c
2015-10-29 17:25:51 +00:00
James D. Forrester 9871108189 build: Enable phpcs rule 'MediaWiki.WhiteSpace.SpaceAfterControlStructure.Incorrect' and make pass
Change-Id: If230a568463a048b59138850ededa2b02fb61f46
2015-10-29 17:25:45 +00:00
James D. Forrester eb4e17f15d build: Enable phpcs rule 'PSR2.Classes.PropertyDeclaration.ScopeMissing' and make pass
Change-Id: I96b295bba43185085631722e10a5e5cfa7ecf27f
2015-10-29 13:06:43 +01:00
James D. Forrester 7f7e6b8159 build: Enable phpcs rule 'PSR2.Methods.MethodDeclaration.StaticBeforeVisibility' and make pass
Change-Id: Iff0709c3a30f8c39d54bab2361e109c96aea6aa0
2015-10-29 13:06:43 +01:00
James D. Forrester 42e2764494 build: Enable phpcs rule 'PSR2.Methods.MethodDeclaration.AbstractAfterVisibility' and make pass
Change-Id: I316d30e5474646cfc7a8a03b540c09741cd7fdc6
2015-10-29 13:06:43 +01: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 39edc4ce48 Document that text from getSecondaryLinks() isn't escaped
Change-Id: Ia87faa54df7631522e41871d7bbb37345d5bce0e
2015-10-29 00:35:13 -07:00
Kunal Mehta 1e5ab0331e Fix @return doc on EchoEventPresentationModel::getPrimaryLink()
Change-Id: I5ab5df0706395aa5393d2470ebbeadbaa4e7fe6b
2015-10-29 00:34:01 -07:00
Kunal Mehta 46d0e7d0fd API: Remove no-op wfProfile(In|Out) calls
Change-Id: If64abbfb5bc22556ca376311cba8a5d460d8a668
2015-10-28 18:28:22 -07: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
Kunal Mehta 1a72434c62 API: Remove pre-1.25 compat code
We already require at least 1.26.

Change-Id: I09ca09fd06fdbf0b367f8a454898c6b7992be42d
2015-10-26 08:41:57 -07:00
Kunal Mehta c8329a728e ApiEchoNotifications: Remove unused variable
Change-Id: I4fe3b7b162c552d8db0ac5bba8b431339cdd137f
2015-10-26 08:39:34 -07:00
Kunal Mehta 1f366807d6 Don't use $wgLang in DataOutputFormatter
Require callers to pass it in.

Change-Id: I94ec940495a681151b289294186121462d4b5b5c
2015-10-26 08:37:57 -07:00
Kunal Mehta f40ef7019f Require $user parameter in DataOutputFormatter::formatOutput()
All callers already pass it.

Change-Id: Ic99893f53d6379a3fbbc2a45193e6804264ff7b7
2015-10-26 08:34:51 -07:00
jenkins-bot 0beefa78c3 Merge "Clean up and refactor formatting system" 2015-10-23 23:20:00 +00:00
Kunal Mehta 7f6f6536ed EventLogging: Make sure eventId is an integer
Bug: T116205
Change-Id: Ifb9119cbd24b58f24a0eaa0a17a1345220374a4a
2015-10-21 11:08:50 -07:00
Kunal Mehta 56c4b95087 Clean up and refactor formatting system
The workflow to format a notification is
* Get EchoEvent, User, and Language
* Get EchoEventFormatter implementation for notification type
** EchoEventFormatter returns structured data about each part of the
notification (header, body, primary link, secondary link(s))
* Each output type will have a formatter class (e.g.
EchoSpecialNotificationsFormatter, EchoPlainTextEmailFormatter) which
takes a EchoEventPresentationModel and generates whatever it wants
(HTML, plain-text email, etc).

Included is an example conversion of the user-rights and mention
formatters. The previous infrastructure will remain in place for
backwards compatability until other extensions can be updated.

Bug: T107823
Change-Id: I4397872a7ec062148dfcb066ddd8ab83f40486ac
2015-10-19 10:00:23 -07: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
Stephane Bisson 318182299a Add target-page to edit-user-talk to dismiss notification
Bug: T112477
Change-Id: I1f3de6b1d271a1245d581c5f6fb246ee23035fb5
2015-09-29 09:17:35 -04:00
Alangi Derick ba4789760c IP addresses should link to Special:Contributions instead of user page for revert
This changes the revert notification (special page version) to link
to the contributions page for anonymous (logged out) editors.
It still links to the user page for logged in editors.

Bug: T55564
Change-Id: Ib1f17fb88237b96cda63dd30ed488a8ffd84750e
2015-09-20 15:53:10 -04:00
Kunal Mehta b539621b7f Split up ext.echo.nojs into badge and notifications styles
And rename "nojs" to "styles". It was supposed to mean base styles that
are used by no-JavaScript and JavaScript mode, but it confused people.
Hopefully "styles" is clearer.

Change-Id: Ie8d668fb0d95a9162392c5fa7c3200bcacef1025
2015-09-16 12:52:12 -07:00
Aaron Schulz cf721adf63 Also defer the markRead() master updates
Bug: T92357
Change-Id: Ia85a1e431b27f6ef528dce894e98878ffe2d60d3
2015-09-15 13:05:10 -07:00
Kunal Mehta 3940f523ba Only load nojs Special:Notifications styles on the special page
Bug: T112407
Change-Id: I4112c8b819127dea7c5e2117feedfeecf583ef1f
2015-09-12 21:23:08 -07:00
Aaron Schulz 15772bce36 Defer the "seen time" updates on GET requests
Bug: T94448
Bug: T92357
Change-Id: I241662f9fd9aa13ef7468c9d76c26e58746f215a
2015-09-10 15:56:12 -07:00
Southparkfan bd67fc0356 chmod 644 for php files
Bug: T111740
Change-Id: I244b2e08e413602da305b4995189f5755ec6eee2
2015-09-08 18:11:25 +02:00
jenkins-bot 43604b5922 Merge "Move edit-user-talk to messages" 2015-09-05 00:04:52 +00: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
Moriel Schottlender c5434d59fe Use the correct cache key when storing 'hasMessages'
The key used was empty, and therefore did not work. Use the correct
key when caching 'hasMessages' for the user to see their message
badge when receiving the first message.

Change-Id: Ib5b07854f96efed974d53267d9ed573c6ca1cf04
2015-09-03 17:30:01 -07:00
jenkins-bot 61516ebe53 Merge "Separate 'seen time' for alerts and messages" 2015-09-03 21:17:06 +00:00
Moriel Schottlender e650df6644 Separate 'seen time' for alerts and messages
Bug: T111285
Change-Id: I277f94ae705d3323ac8612111d7fd704b36793cb
2015-09-03 13:14:15 -07:00
jenkins-bot 59a8f9096b Merge "Require a Language object in DiscussionParser::getTextSnippet()" 2015-09-03 18:56:27 +00:00
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 86da8324d5 Require a Language object in DiscussionParser::getTextSnippet()
To avoid using $wgLang directly. We still have to use it in
detectSectionTitleAndText for now though.

Change-Id: Ic901ed05d4e8f6291caa55d866ce58f7300880f5
2015-09-02 11:09:26 -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