Commit graph

567 commits

Author SHA1 Message Date
Roan Kattouw cd4194bd40 Avoid invalid API response when server-side cross-wiki requests fail
If all server-side cross-wiki requests fail, we'd return an empty API response.
This is invalid, the frontend expects things like list:[] to still be there.

Change-Id: I72fc5a017647ca28abbc061992fa4868ca5737f4
2016-05-09 11:08:00 -07:00
Roan Kattouw ac85f28f3e Use global user ID in global cache keys
We were using the local user ID instead, which is not the
same on every wiki, which caused strange cache staleness
and pollution behavior.

Run sets through a wrapper function (gets were already wrapped)
so we can update the instance cache and deal with uncomputable
cache keys in one place. A global cache key may be uncomputable
if we fail to obtain the user's global user ID (users aren't
supposed to be unattached, but some are).

Also bump the cache version to get rid of polluted cache entries.
Bumping this version number was probably a good idea anyway,
with all the recent changes.

Bug: T134533
Change-Id: I1c4f0c2f2eded480c80f8ec7a49a04feb7c5ecfb
2016-05-05 17:21:32 -07:00
Roan Kattouw e57dbfc86b Follow-up 73ec3a331: fix fatal when no cross-wiki results are found
If we don't initialize $results, getForeignNotifications() will return
null, and this will cause a fatal when trying to += it into an array.

Change-Id: Ibb868cbf0b52ff2de41c5be82c9605801e51ffae
2016-05-05 12:58:28 -07:00
Kunal Mehta b6f742bc46 Add plain text email formatter
Formatters based on presentation models for
individual event emails and digest (daily, weekly)
plain text emails.

Bug: T121067
Change-Id: I4eceaf521315adab7429a8a73ffca70ebcddab86
2016-05-04 13:35:37 -04:00
jenkins-bot 19b051164b Merge "Use MultiHttpClient for server-side cross-wiki requests" 2016-05-04 17:15:29 +00:00
jenkins-bot f4897e11b2 Merge "Server-side crosswiki requests" 2016-05-04 17:13:23 +00:00
jenkins-bot f08b108e2e Merge "Replace mark-as-read-on-click with ?markasread= URL parameter" 2016-05-04 01:09:27 +00:00
Roan Kattouw 73ec3a331e Use MultiHttpClient for server-side cross-wiki requests
Change-Id: I6d647f250941a671b7b63890ef115380a22d38cc
2016-05-03 17:46:59 -07:00
Matthias Mullie ae3e8a6b8c Server-side crosswiki requests
Passing a param 'wiki' with a list of wiki names will now
result in getting notifications from these wikis too.
It'll execute multi-curl calls to the given wikis to fetch
their results.

Bug: T130636
Change-Id: I89df54366501acfe3e5cf6d2f313ee32694ba387
2016-05-03 17:45:45 -07:00
Roan Kattouw 7942a2de79 Replace mark-as-read-on-click with ?markasread= URL parameter
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
2016-05-03 00:20:03 -07:00
Roan Kattouw 1b7c2c781a NotifUser: Reduce queries in resetNotificationCount() by hackily computing some values from others
Change-Id: Id349ac91c7ed8f308fce327bbf5f5e5f088b7935
2016-05-02 23:17:18 +00:00
Roan Kattouw 0807c3c5ad NotifUser: Refactor getNotificationCount() and friends, add caching for global counts
Previously, getNotificationCount() only looked at local notifications,
and foreign notifications were added in separately by getMessageCount()
and getAlertCount(). This didn't make any sense and resulted in
counter-intuitive things like I4d49b543.

Instead, add a $global flag to getNotificationCount(). If $global=false,
the local count is returned as before, but if $global=true, the
global count (=local+foreign) is returned. If $global is omitted,
the user's cross-wiki notification preference determines which is returned.

Update getLastUnreadNotificationCount() in the same way, since it had
the same issues.

Also add caching for global counts and timestamps, using a global
memc key.

Bug: T133623
Change-Id: If78bfc710acd91a075771b565cc99f4c302a104d
2016-05-02 16:16:57 -07:00
jenkins-bot 3f4e024f3a Merge "Move section methods into a trait" 2016-05-02 12:29:39 +00:00
Matthew Flaschen bd317224ac Have getTimestamp actually return max for all sections.
Before, it was just returning the timestamp of the messages section.

Tested by creating a message on one foreign wiki, then an alert on
another and using:

http://mobile.wiki.local.wmftest.net:8080/w/api.php?action=query&format=jsonfm&meta=notifications&notsections=message|alert&notformat=model&notlimit=25&notunreadfirst=1&notprop=list|count&uselang=en&notcrosswikisummary=1&_=1461881446668

Change-Id: I870229b09a8add08eb3542e3ab70db58352d00b8
2016-04-28 23:26:13 +00:00
Roan Kattouw 33124f35a8 Move section methods into a trait
Change-Id: Ief2005918b92945ff93aea85d17e595c7c38adf2
2016-04-28 20:52:09 +00:00
Matthew Flaschen 6d6845d9e4 Display special: Add which section (curr. Alert v. Msg.) each type's in
Replace getAlertEvents and getMessageEvents with
getEventsForSection.

Also, add IDs for linking to sections

Bug: T123018
Change-Id: Ic480320a52a401609d853fc8c75c781b89bb8722
2016-04-28 20:33:52 +00:00
Roan Kattouw e864b1fc47 ForeignNotifications: Fix fatal when one section has no timestamp
Bug: T133921
Change-Id: Iab82fa9439e26832731f4f56b5be18985203f49c
2016-04-28 10:39:05 -07:00
jenkins-bot ff67a0377b Merge "Repurpose survey call-out in the footer for beta feature invitation" 2016-04-27 19:53:34 +00:00
jenkins-bot e4d953168b Merge "ForeignNotifications: Move preference check out of constructor and allow force-enable" 2016-04-27 16:57:47 +00:00
jenkins-bot 56b4f161e4 Merge "Clean up section title handling in mention and edit-user-talk presentation models" 2016-04-27 16:29:49 +00:00
Roan Kattouw 314e00def5 ForeignNotifications: Move preference check out of constructor and allow force-enable
Instead of checking the cross-wiki notifications preference
in the constructor, move it to a method that other code can reuse.
Also add a parameter allowing foreign notification data to be
inspected even if the user has disabled the preference.

Change-Id: I6600ff27aa5af1737b3a6c3cde586d325886bc86
2016-04-27 16:23:21 +00:00
Roan Kattouw d8bf305e68 ForeignNotifications: Use ALL instead of null as defaults for $section params
Change-Id: Ieab7090742fd7f75c079be72cd9c07e3e1448ed1
2016-04-27 08:31:15 -07:00
Roan Kattouw 4f7f1a3a09 Repurpose survey call-out in the footer for beta feature invitation
Removing the info popup because we don't have to show
a privacy notice when linking within the wiki.

This adds a database query to every page view for logged-in
users; If78bfc710, once merged, will fix that.

Bug: T117669
Change-Id: I8451db34ae8e94264e4921ecd6df6e4b32c7623a
2016-04-27 07:23:30 +00:00
Roan Kattouw 5152385887 Make EchoForeignNotifications::getApiEndpoints() static
It doesn't use $this, except to call getWikiTitle(), so make that
static too. This allows us to use it in EchoForeignPresentationModel
without creating a second instance there.

Change-Id: If778db0852de1cbf5c2190ce50ce561745bb3887
2016-04-26 17:33:30 -07:00
jenkins-bot 2bc334cc62 Merge "Unlisted special page for displaying notification configuration" 2016-04-23 03:54:08 +00:00
Matthew Flaschen d27f32f9b1 Unlisted special page for displaying notification configuration
This provides a simple unlisted special page,
Special:DisplayNotificationsConfiguration, to document how the
notifications are structured and configured.  It shows:

* Which types are in each category
* Which notify types (web/email) can be enabled for each category
* Which notify types are mandatory for each category
* Which notify types are enabled by default:
** For existing users
** For new users

Bug: T132127
Change-Id: I25b447a69a7c984941dfd703345d7977c0000bfe
2016-04-22 20:31:04 -07:00
jenkins-bot f6affc4655 Merge "BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical" 2016-04-23 02:27:40 +00:00
Matthew Flaschen 5ecc6aa7c8 BREAKING CHANGE: Change $wgEchoDefaultNotificationTypes to be logical
Merge and deploy at the *same time* as:
* BounceHandler - I3c669945080d8e1f67880bd8a31af7f88a70904d
* mediawiki-config - I13817c139967ed9e230cfb0c87c5de66da793c96

Despite claiming to be about categories, $wgEchoDefaultNotificationTypes
was actually configuring both categories and types (which go inside
categories).

For example, 'thank-you-edit' is a type, but 'emailuser' is both
a category and a type (when used as a category, this has special
effects at Special:Preferences).

Since types and categories can and sometimes do have the same names,
this leaves no way to properly and clearly configure them.  It also
makes it difficult to document what is going on (as required by
T132127).

Split into three variables:

$wgDefaultNotifyTypeAvailability - Applies unless overriden

$wgNotifyTypeAvailabilityByCategory - By category; this can be and is
displayed at Special:Preferences

$wgNotifyTypeAvailabilityByNotificationType - By type; this cannot
be displayed at Special:Preferences. To avoid confusing the user,
we introduce a restriction (which was previously followed in practice,
AFAICT) that types can only be overridden if the category is not
displayed in preferences.

Otherwise, it can look to the user like a category is on/off, but the
types within might have the opposite state.

Due to this configuration change, this is a breaking change, and needs
coordinated deployments.

This also lays the groundwork for T132127

Also change terminology to consistently use "notify type" for web/email.

It was mixing between that and output format (which unfortunately
sounds like the API format, e.g. 'model').

Bug: T132820
Bug: T132127
Change-Id: I09f39f5fc5f13f3253af9f7819bca81f1601da93
2016-04-22 19:08:12 -07:00
jenkins-bot 158d19a00a Merge "Switch $wgMemc usage to proper cache/stash usage" 2016-04-22 23:01:14 +00:00
jenkins-bot dc14945dcd Merge "Change (opt-out) noforn to (opt-in) crosswikisummary" 2016-04-22 19:29:53 +00:00
jenkins-bot 4bf6c5d7cd Merge "List is no longer an associative array" 2016-04-22 19:23:06 +00:00
Matthias Mullie 57ee975984 Change (opt-out) noforn to (opt-in) crosswikisummary
I thought the name was confusing, and would be even more so
if we get real notifications from other sources.

Meanwhile also split $crossWikiSummary into 2 properties:
- 1 with the class
- 1 to indicate if it should be used

Change-Id: I0e83be7924c8c77680ea1ada3f2bd6a190ce6149
2016-04-22 12:14:21 -07:00
Matthias Mullie b10bd70033 List is no longer an associative array
This would soon become problematic when output can come from
multiple sources, with potentially conflicting ids.
The ID is already included in the result anyway.

Change-Id: Id92150c71c68958819fe0ee329e70393052c34c9
2016-04-22 12:13:21 -07:00
Aaron Schulz 33fe3490d3 Switch $wgMemc usage to proper cache/stash usage
Change-Id: I688e21ff4ff999f11c0373ad611075c14fa5db2a
2016-04-22 11:58:03 -07:00
jenkins-bot 748068b66c Merge "Remove param index" 2016-04-22 18:47:12 +00:00
Roan Kattouw c5361da55a Clean up section title handling in mention and edit-user-talk presentation models
They were using different code and different approaches.
I've left getSection() and the code for creating a Title
with a section duplicated for now, and I'll move them
into a trait in the next commit. I wanted to do that
separately because we aren't using traits in this
code base yet.

Change-Id: I56cf745d2cc8a6c43caec08024187de9598cecb8
2016-04-21 18:31:12 -07:00
Aaron Schulz e520e764c4 Make notifications use getMainStashInstance()
This makes sure resetNotificationCount() actually affects all DCs

Change-Id: If1af121b54d2ec50473a55308d8326f24a1b43b8
2016-04-21 19:40:12 +00:00
Matthias Mullie e8d1f6a888 Remove param index
It's (mostly) unused, and it would become problematic once we have
notifications from multiple places (where those ids could conflict)

Change-Id: Ib3bb5ae1e5689037b38290c9ce3d8691f52582b0
2016-04-21 13:33:15 +02:00
jenkins-bot a85a78524e Merge "Use plaintextParams() for snippets and sections" 2016-04-20 12:37:05 +00:00
Stephane Bisson 62216cab80 Display only one foreign bundle on mobile
Display a single foreign bundle containing both
alerts and messages on mobile.

Bug: T131683
Change-Id: I9d3d160586c31457d3a1825e9cecadde42debf7c
2016-04-19 16:02:41 +00:00
Roan Kattouw b91360131c Use plaintextParams() for snippets and sections
We ended up double-parsing section titles, which resulted
in strange behavior when the section title was something like
{{tl|infobox}}.

Bug: T132872
Change-Id: I4434624f392cd0e1df39374d45d60f7d83be7161
2016-04-19 16:02:26 +00:00
Matthias Mullie f1c708ef9e Make foreign NotificationGroupItems aware of their section
This caused notifications on mobile to show notifications for
both alert|message, as the type was always "all".

Bug: T130801
Change-Id: Ice245eb407ca360d8e882c0ba48cb7b3e0ecb851
2016-04-01 15:38:22 +02:00
Roan Kattouw 8b7e5dafe6 RevertedPresentationModel: Don't double-parse summary
formatSummary() was first parsing the summary using the
summary parser, then handing off the resulting HTML to
getTextSnippet() which parsed it again with the normal parser.

Bug: T131087
Change-Id: I2724ccb7c23579b3f02dea57d4fc833079169adf
2016-03-29 22:16:31 -04:00
Matthias Mullie 3641f7c79b Bundle memcached requests
Bug: T127687
Change-Id: I5ccb317d763b9757ba914830bc6dd5129dd5bd1c
2016-03-24 16:33:15 +01:00
jenkins-bot 61cc85e34a Merge "Let EchoUserNotificationGateway return a different notification count" 2016-03-24 01:12:33 +00:00
Matthias Mullie a3d2196851 Notification titles should differentiate subpages of the talk page
Bug: T129686
Change-Id: If3a8eec489cbbea8c2ed7c03b75986ab7fd6c262
2016-03-23 15:19:43 +01:00
jenkins-bot 3a246a2ea2 Merge "Sort wikis by timestamp of most recent notification" 2016-03-22 17:17:50 +00:00
Matthias Mullie 6175a9c1b5 Let EchoUserNotificationGateway return a different notification count
There is currently a hard cap of badge display count.
We'll want to be able to request a different count for other purposes:
cleaning up old notifications, for example. We want to keep around a
certain amount of motifications (which is higher than the display count)
so we must be able to query a different count.

Change-Id: Id460fd7f46e397d22da49283b30fd12a6bbb0c9f
2016-03-22 14:22:15 +01:00
jenkins-bot 8b15325346 Merge "Make plural support for large values (100 or more) explicit in l10n" 2016-03-17 21:53:40 +00:00
Roan Kattouw bfbfa6be62 Sort wikis by timestamp of most recent notification
Both in the order of the cross-wiki bundles themselves, and
in the message in the notification body.

ForeignNotifications tracks timestamps per wiki per section,
and exposes these through getWikiTimestamp(). ApiEchoNotifications
adds these timestamps to the sources manifest, and also sorts
the list of wikis by timestamp (it'd be nicer to do this in
ForeignPresentationModel instead, but then we'd have to create a new
ForeignNotifications instance which causes a duplicated DB query).

NotificationsModel receives the timestamp for its wiki as its
fallback timestamp, and makes getTimestamp() return this value
during the pre-population phase. This causes its parent to
automatically sort it correctly.

Because the timestamp of a wiki depends on the section (alerts vs messages),
we can't put it in the global sources manifest at the top level
of the API response. Instead, get rid of this global sources
manifest and put all the sources data in the foreign notifications
directly. This allows us to specify different timestamps, and also
allows us to get rid of code in EchoApi that was already remapping
the API response to this format.

Bug: T130298
Change-Id: Ie083fbb1ccaf74fbe804633d87ef03c9e71b120f
2016-03-17 14:21:16 -07:00
jenkins-bot 34742aa3a6 Merge "MentionPresentationModel: use Title::equals()" 2016-03-17 20:36:10 +00:00
jenkins-bot a0031a4fc9 Merge "Unconvolute DiscussionParser::getTextSnippet()" 2016-03-17 09:54:21 +00:00
Matthew Flaschen cac85b635f Make plural support for large values (100 or more) explicit in l10n
This involves:

* Making this value no longer admin-configurable.
* Changing getNotificationCountForOutput to return only a single value
  Since there is no + in the formatted value anymore, we can actually
  use the same value for both.

  This is a B/C break, but hopefully worth it to simplify the method
  call.

  For now, the excess parameter is just marked unused.  It could be
  removed at some point if the translations are updated.

This must be merged at the same time as:
* Flow - Ibfa56b1af9e8c56b4c5f900e0d487bc09688b2a2
* MobileFrontend - Ibf784b279d56773a227ff261b75f2b26125bbb63 (well, MF
  can be merged first)
* translatewiki - I2a4b6938aed49e4101deb6b9351c43656a863490

Also, change 1 to One/one, per Siebrand on the task.  This can easily
be dropped/undone if we don't want it.

Also, remove reference to no-longer-existent notification-page-linked-bundle

Bug: T127288
Change-Id: Iabeaae747f99980c0610d552f6b38f89d940b890
2016-03-16 18:43:16 -04:00
Roan Kattouw 1a4bdbc23a MentionPresentationModel: use Title::equals()
Change-Id: Ib0c5b0f5649edef79cf7ad272eb207711af8608d
2016-03-15 15:50:40 -07:00
Timo Tijhof 35b7339152 Ignore value of MW_PHPUNIT_TEST
To match use of this constant everywhere else.

Change-Id: Ia173b2b7217ffa8b924d9f164da89bd3b547c452
2016-03-14 16:44:33 +00:00
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