Commit graph

576 commits

Author SHA1 Message Date
Stephane Bisson 6cca5b6a01 Fetch foreign notifications before marking them as read
Bug: T134579
Change-Id: I4b88bbf5e23d9fbc066e17e1af77a3874a824b04
2016-05-06 11:47:58 -04:00
Moriel Schottlender 7055f83fe0 Use server-side cross-wiki requests in the frontend
Fetch cross-wiki notifications by asking the local API, but still
maintain the ability to send remote requests to the foreign wikis
for mark-as-read operations.

Bug: T130636
Change-Id: I48524cb9dff43257a401d7483e939edfb042b928
2016-05-04 21:21:08 +00: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 73b0a083d4 FooterNoticeWidget: Top-align the close icon
Bug: T117669
Change-Id: I70d8df95e719824c8f135d01d6d9bf63a20daf02
2016-05-02 14:36:01 -07:00
Roan Kattouw fbf702aa7e Follow-up 1608a5e6fc: add hasOwnProperty check
To prevent crashes when wikis extend Array.prototype.

Bug: T133817
Change-Id: I40063d7997a1dfb72053eb09e48d4480dbf371a8
2016-04-28 00:34:11 +00: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 1608a5e6fc Follow-up b10bd7003: allow object instead of array for b/c with wikis running old code
Change-Id: I1566b73e0d8daea6c2e701f60cbcb9dd42129ec9
2016-04-26 15:57:25 -07:00
Roan Kattouw 91a7833209 Follow-up 57ee9759: add notnoforn=1 for b/c with wikis running old code
Change-Id: I24b697d59f9306b9cfa40372c5d4a92ba331b20b
2016-04-26 15:55:07 -07: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
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 93c118693a Merge "Apply momentjs hack for short relative times on mobile too" 2016-04-20 01:50:51 +00:00
Roan Kattouw c9332d8b50 Apply momentjs hack for short relative times on mobile too
Split the moment hack out into its own file and put it in
ext.echo.ui, so it gets picked up by both the desktop and
the mobile modules.

Bug: T133134
Change-Id: Ic5b3e63fb6941a310d85ea7776447d1d7153cf91
2016-04-19 17:53:02 -07:00
Roan Kattouw 6c49d3edda Update OOUI hacks for I8987dade5ed
min-width and min-height are now set on icons. This breaks the ability
to scale icons down, so override these rules.

Change-Id: I6372f0fe17ccfd853bde497730c49cbcf9f89a41
2016-04-19 15:57:11 -07: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
jenkins-bot c594852bf7 Merge "Add tooltips for 'mark as read' and 'more options'" 2016-04-19 01:33:28 +00:00
Matthew Flaschen bb1192a531 Increase line-height for survey to 16px
Bug: T131893
Change-Id: I51e80117d810e2927b6b31f4b2c68de08d07293d
2016-04-18 18:43:40 -04:00
jenkins-bot 6d3e9babb9 Merge "Fix regression from 0fc63bde36: unbreak number formatting in short timestamps" 2016-04-17 18:18:56 +00:00
Stephane Bisson f3ce2de964 Add tooltips for 'mark as read' and 'more options'
Bug: T130831
Change-Id: I1533d20019157c05f9354a60661512a33920c336
2016-04-15 16:30:14 -04:00
Matthew Flaschen 732c8496f0 Also show the survey tooltip on click
To implement this, use PopupButtonWidget and override to handle hover
in addition to click.

Bug: T128937
Change-Id: I79f5bb5839491516b0a3f77630b481cd6c2cc3da
2016-04-08 17:13:28 -07:00
Roan Kattouw a4ea2de123 FooterNoticeWidget: Set image height explicitly
If we don't do this, the footer becomes slightly taller
when the image loads, which makes the popup clip incorrectly.

Change-Id: Ica84d704692676d884b847f8fe01c49319f04931
2016-04-08 17:13:28 -07:00
Moriel Schottlender bdb50c7b60 Update notifications when reopening the popup
When reopening the popup, update the notification list to reflect
changes.

Bug: T127027
Change-Id: I6c3e948293b7c25cfab37f96b1faaca844014c28
2016-04-06 15:09:03 +00:00
Roan Kattouw a9c6515a4b Fix regression from 0fc63bde36: unbreak number formatting in short timestamps
We were using momentjs here before (causing bug T123845),
but we switched to using a hack for short timestamps.
This hack didn't call convertNumber(), so we stopped performing
number formatting for languages that don't use Western Arabic
numerals (0-9).

Strictly, that regression "fixed" T123845 because it caused
0-9 to be used in all cases, including the case that that bug
asked for. This patch fixes the regression but preserves the
desired behavior for arwiki, since convertNumber() respects
$wgTranslateNumerals.

Bug: T123845
Change-Id: Ic9acb12f534e0f049e22577afe276f8bf68f691d
2016-04-02 18:40:22 +03: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
jenkins-bot 722f9f58a8 Merge "Remove unused icon files" 2016-04-01 11:15:53 +00:00
Roan Kattouw c15cb2675f jscs: Enable checkRedundantParams and make pass
Change-Id: I3182708b5ab5b127b7e4a32d875d390485370816
2016-03-31 07:12:46 +00:00
jenkins-bot ffa21614c3 Merge "jscs: Enable checkRedundantReturns and make pass" 2016-03-30 20:36:27 +00:00
Roan Kattouw 8f01e880b6 Change threshold for survey invitation from 2 unread notifs to 1
Bug: T128937
Change-Id: I28d5d46a5ecd1c184269b7f8d3ba984bfedad77b
2016-03-29 17:25:40 -07:00
Moriel Schottlender e0ffd26c23 Change parameters for user survey footer message
Bug: T128937
Change-Id: Idd299293fad8264298174bc372318445cf26c4d3
2016-03-28 13:45:59 -07:00
jenkins-bot cd6f1b80ff Merge "Stop counting notifications objects on the client" 2016-03-25 20:45:44 +00:00
jenkins-bot d91612014a Merge "jscs: Enable checkParamNames and make pass" 2016-03-25 20:37:02 +00:00
Stephane Bisson 623d07011c Stop counting notifications objects on the client
The flyout loads no more than 25 notifications
from a given source. Using those in-memory notification
objects to count how many are currently unread (and
update the badge) produces a result of at most 25.

This patch extracts the responsibility or counting the
unread from the Model/Item/Groupitem structure into
a new UnreadNotificationCounter class. It receives
estimated updates from other components and synchronizes
with the server after markRead/markUnread operations
have completed.

Bug: T129726
Change-Id: I9af4defc00dd491ed2b355eb4e85073476e08ce7
2016-03-25 15:31:00 -04:00
jenkins-bot 9aa272b721 Merge "jscs: Add "checkTypes": "strictNativeCase" and make pass" 2016-03-25 19:27:26 +00:00
Roan Kattouw df8e97173f jscs: Enable checkRedundantReturns and make pass
Change-Id: I8013198fdb5852246a0f8360b931334740eaa147
2016-03-25 11:54:55 -07:00
Roan Kattouw ee7b10bf4b jscs: Enable checkParamNames and make pass
Change-Id: I50340b156b7c23483da1613eaabe8f40c559660a
2016-03-25 11:54:44 -07:00
Roan Kattouw 44a015970f jscs: Add "checkTypes": "strictNativeCase" and make pass
Change-Id: I4be0d72ba192f0b79a92f5efa2f5a16fb0f327b5
2016-03-25 11:47:00 -07:00
Moriel Schottlender 2df435c1fb Styling changes to the footer message
Change-Id: Ie57c0f981671392b751a9774de7be6bb187de3b8
2016-03-24 15:42:10 -07:00
jenkins-bot 22958ab0d0 Merge "Apply text-decoration: none; on non-hover as well" 2016-03-24 01:04:00 +00:00
Roan Kattouw 011bd2e558 Apply text-decoration: none; on non-hover as well
Hover effects aren't the only thing that cause link underlining,
the "Underline links" preference can do this too.

We do still need the :hover selectors too, for specificity reasons.

Bug: T130793
Change-Id: I01c0eaee449470380f3bd752e509043c4580fea9
2016-03-23 16:12:29 -07:00
Moriel Schottlender 94fa679568 Remove duplicate mobile module
Followup to I7891eb3fb46b3 this should be merged only after
the changes in MobileFrontend in Ie592ca738ac2d82 are merged.

Change-Id: I0f28e0757170e8a5b12075d3e9a2343fea7e7155
2016-03-23 20:00:52 +00:00
Moriel Schottlender 06ae707d6e Rename MobileNotificationsWrapper to NotificationsWrapper
We need to use it in more than just the context of mobile, and
there is nothing actually mobile-specific in it. Renaming the
class so it isn't awkward to use elsewhere.

This makes the ext.echo.ui.mobile module unnecessary, but
we leave it in until next patchset so that MobileFrontend
doesn't crash while we wait for the adjustments in
Ie592ca738ac2d8 to be merged.

Change-Id: I7891eb3fb46b350f0b325bf0a2b56b2cd55ff1d7
2016-03-23 19:47:23 +00:00
jenkins-bot cf99b3214e Merge "Add footer notice widget for invitations for feedback" 2016-03-22 19:32:57 +00:00
jenkins-bot 3a246a2ea2 Merge "Sort wikis by timestamp of most recent notification" 2016-03-22 17:17:50 +00:00
Moriel Schottlender e50ef3841a Add footer notice widget for invitations for feedback
Add a mw.echo.ui.FooterNoticeWidget that includes a link to
a feedback survey, and three config variables:

* $wgEchoShowFooterNotice: Enable this feature per wiki
  (Defaults to false)
* $wgEchoFooterNoticeURL: The URL for the survey
  (Defaults to '')
* User preference 'echo-dismiss-feedback-alert': determines
  whether the user permanently dismissed the feedback alert.
  (Defaults to false)

Bug: T128937
Change-Id: I918a70beaba7b173e764519fe4fe0f780b61082d
2016-03-18 17:02:31 -07: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
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 02252d0531 Work around regression in OO.ui.FloatableElement
FloatableElement incorrectly believes it doesn't need to
position itself when its closest scrollable is the same as
the closest scrollable of the container. This causes
the dotdotdot menu to be placed at the top left of the screen
if the notifications popup is not scrollable. If it is scrollable,
everything works fine. This regression was introduced by I5b5d7936c4d.

Work around this by setting overflow-x: auto; on the popup body.
This is a no-op, but tricks OOUI into thinking that the popup
body is scrollable even when it visually isn't. We can't use
overflow-y for this, because we still need to set overflow-y: auto;
on the popup body to work around a Chrome bug where right-floated
elements don't move over when the scrollbar appears.

Bug: T130153
Change-Id: I8bd8a26a4931444a760d2159779240272c51f966
2016-03-16 15:40:27 -07:00
jenkins-bot 059b368e2d Merge "Adjust line-height of bundle group titles" 2016-03-16 17:58:10 +00:00
jenkins-bot a624a95205 Merge "Adjust bottom-alignment of action buttons in notifications" 2016-03-16 17:58:07 +00:00