Commit graph

88 commits

Author SHA1 Message Date
Moriel Schottlender 3a710790d5 Add a SeenTimeModel to handle seenTime in sources
This organizes the operation of seenTime so we can store and
follow up on it based on different sources, as well as update
it correctly remotely when needed.

Change-Id: I629ecfc84999be998b45c9c7adb00ea7e3e51742
2016-07-15 11:25:38 -07:00
Moriel Schottlender 7879f0c9f8 Change 'messages' to 'notices' throughout the interface
Bug: T139520
Change-Id: Ib7f4dc4ea1ff4c5d1fccdc5fdf0c66b049162cb2
2016-07-07 15:57:49 -07:00
Stephane Bisson f8a8d392d6 Expandable bundle
Support bundles being expandable
to show their sub-notifications.

Bug: T114356
Change-Id: I1507cae360f45cc87f2d60e966b4d047abfa202d
2016-06-28 15:37:54 -04:00
Moriel Schottlender a1ec29d06a Add a PromisePrioritizer and use it for notifications fetching
This will allow us to let the user click filters quickly, effectively
changing the promises sent to the API, but let the API only resolve
with the latest requested promise.

Bug: T136895
Change-Id: I698a2b8eced6d8ee997efef353697d27d92cfb2f
2016-06-23 14:12:00 -07:00
jenkins-bot 45d8fdf24f Merge "Add a cross-wiki sidebar to the Special:Notifications page" 2016-06-21 21:57:48 +00:00
Moriel Schottlender 820d2b0fa7 Add a cross-wiki sidebar to the Special:Notifications page
Add a sidebar with cross-wiki sources and pages of unread notifications.
The filter allows the user to fetch notifications from a foreign source
and specific pages if those exist.

Bug: T129366
Change-Id: I57d827a47f80274d75364c2099a9624049a26834
2016-06-21 14:49:42 -07:00
Moriel Schottlender f84808b83a Change mark as read buttons to circles
Allow for mark read and mark unread through the side button, and
change its style according to spec in the ticket.

Bug: T126214
Change-Id: I78a93c0545bbe2d7c11a0c62557cd2e97e9d3866
2016-06-21 11:54:00 -07:00
Roan Kattouw 4028160906 Use localized weekdays on Special:Notifications
Bug: T137634
Change-Id: I97d7058657782d1bbc878c30e0712b1a8833dda1
2016-06-13 13:09:51 +01:00
jenkins-bot 7c89fc0fa2 Merge "No-JS special page: One-click mark as read" 2016-06-01 18:21:56 +00:00
Moriel Schottlender cf99479468 Display a message if there are no notifications in Special:Notifications
The zero results can either be because there are no notifications
at all for this user in the local wiki, or because there are no
results for the specific filter. Both messages are used for either
case.

Also, clean up the display of push/pop pending for the inbox widget
and hide the label in case the message count is 0 or 1 notifications
as it is unhelpful and irrelevant in these cases.

Bug: T136586
Bug: T136574
Bug: T129363
Change-Id: I1465f772bb9f5247df645d6612f951e5fd7d38cf
2016-05-31 23:13:48 +00:00
Moriel Schottlender 6e21a620ef Clean up the pagination in Special:Notifications
Add a pagination widget with events and separate the logic for
organization. Let the widget listen to events from the pagination
model so it always keeps itself updated.

Change-Id: Id1df112cbb0d90195217e88fbee97a59170b99c5
2016-05-31 16:12:09 -07:00
Matthew Flaschen 188e8d7395 No-JS special page: One-click mark as read
Bug: T136361
Change-Id: I7896dbdf25d2c1624f97777f4c8d0af41b195ef0
Depends-On: Ic31f857c749d62a32cafae68dc3f1cbd86e1e382
2016-05-27 17:23:29 -07:00
Moriel Schottlender e5e19dd0f1 Filter notifications by read state in Special:Notifications
Change-Id: I7b47e76ae48eaf4732d99616baa3b4b1ee4ddff5
2016-05-27 13:47:41 -07:00
Moriel Schottlender 9262614ded Initial version of Special:Notifications Javascript page
Bug: T129176
Change-Id: I2f55358c16f78e234ec19154b944a4edebfbe639
2016-05-27 13:42:25 -07:00
jenkins-bot b894c3407a Merge "Add style to the NotificationsWrapper" 2016-05-26 22:58:40 +00:00
Stephane Bisson 52525249e6 Adjust styling for "Mark group as read"
Bug: T134204
Change-Id: Ia0486fa400be7e96ffc4e1ad47f952c17f40042c
2016-05-26 13:30:49 -07:00
Moriel Schottlender 299adfe6b1 Add style to the NotificationsWrapper
We have to make sure that any notifications wrapper has the css
term overflow-y: auto; so that the popup menus behave properly.

Change-Id: I14a1a9f1c3610ef27fe04aa4b1e7197c08d1dfd4
2016-05-19 13:43:51 -07:00
Moriel Schottlender 8e76bc4126 Refactoring Echo's front end for MVC
Changing the way Echo's front-end architecture works to work with
model-view-controller methodology.

Change-Id: I97862402c41bc04dd41cd08d79f19ff677340249
2016-05-18 12:28:45 -07:00
Moriel Schottlender 15a44768f4 Add mark-as-read button to notifications in Special:Notifications
Bug: T115528
Change-Id: I54dba5f86d28a069659d66dede5b7ab9981213aa
2016-05-11 10:41:32 -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 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 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
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
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
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
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
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
jenkins-bot 39820d8b62 Merge "Add MobileNotificationsWrapper for Mobile display" 2016-03-16 17:57:26 +00:00
Moriel Schottlender 56c82f3f9d Add MobileNotificationsWrapper for Mobile display
This is to wrap the mobile notifications in MobileFrontend with
a pendingElement and organize the API calls specifically for the
mixed popup in mobile.

Also added a specific 'ext.echo.ui.mobile' module so we don't
load unnecessary files for mobile.

Bug: T124188
Change-Id: I4a8be19a79b9e38c21907bb9d4123540a648c535
2016-03-16 10:29:42 -07: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 ff41a87105 Merge "Add a short abbreviation for timestamps in notifications" 2016-03-04 02:52:22 +00:00
Moriel Schottlender 0834b91f56 Echo API layer
Split and refactor Echo network handling and create a proper API
layer for the UI to use consistently. Split Echo's API methods into
its own module so they can be loaded along with the initialization
script and manage the API requests.

Change-Id: I0526a14bb8cc0d9729a303e24ab6e43259cc86bb
2016-03-03 23:40:12 +00:00
Moriel Schottlender 0fc63bde36 Add a short abbreviation for timestamps in notifications
Use 'm' instead of 'minutes', 's' instead of 'seconds', etc, for
shorter timestamp rendering in the notification list.

Bug: T125970
Change-Id: I9479c5406a4bf44ef560bef2c8f204a9f60cafc6
2016-03-03 11:37:05 -08:00
Stephane Bisson eb873aaa60 Include cross-wiki notifications in unread count
* Client-side only. The backend already counts those.

Bug: T124109
Change-Id: I62e49524bc8cea1ef2d77255e29ff8a919bd1ee7
2016-02-29 16:02:05 -05:00
Roan Kattouw b8ed4c36a8 Use more granular oojs-ui dependencies
This allows us to not load oojs-ui-windows and oojs-ui-toolbars,
which saves 83KB of JS (before gzip). oojs-ui-widgets is another 85KB,
but we can't drop it because we use ButtonSelectWidget for
secondary links.

Bug: T114012
Change-Id: I8db1c7a0c100fbb320d9ea271a4b56bbc4372b1f
2016-02-19 20:25:05 -08:00
Moriel Schottlender 3937857bd8 Convert secondary actions to their own class
This makes the actions more consistent, and also allows for separating
the two behaviors: The one where we need a link to a destination
(User page, diff, etc) and one where we have an action the code needs
to take care of ("Mark as read" or, in the future, volume control, etc)

Also, this allows for adding descriptions to the secondary links in
the dotdotdot menu.

It also fixes the bug where the links did not work.

Bug: T125160
Change-Id: I0ebf3fc62425f86e2e7f1e96b67f8dc34db83efb
2016-02-10 20:12:58 +00: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
jenkins-bot e28a912c3b Merge "Add 'mark as read' as secondary action to unread notifications" 2016-01-26 16:37:11 +00:00
Moriel Schottlender a85561d3d8 Create a specific message for CORS failure in cross-wiki API request
Bug: T123797
Change-Id: I877c826a5571fb1f664af496b9b3469aa24884f6
2016-01-21 15:03:39 -08:00
Moriel Schottlender 5c67c9110f Add 'mark as read' as secondary action to unread notifications
Bug: T121935
Change-Id: I0dda7335ba00492c5dc5a6f0e9f2faea1da612bc
2016-01-21 11:34:27 -08:00
jenkins-bot 47e4e7cd62 Merge "Add missing mw.Title depenency to ext.echo.ui" 2016-01-12 19:13:01 +00:00
Kunal Mehta 6554462c29 Add missing mw.Title depenency to ext.echo.ui
Change-Id: I3578f951d2c6c5c185b6abb6ad5b47dbcc4768a4
2016-01-12 10:43:09 -08:00
Stephane Bisson 60ddc76880 Update page-linked notification text
Bug: T121812
Change-Id: Ie875f105230c8364291a918b869b9c26dbdf1e83
2016-01-12 10:11:31 -08:00
Moriel Schottlender 4b7520af90 Display readable API error message
If an error has occurred while fetching from the API, the
placeholder item should display the API error information.

If the error is specifically a login issue, a specific
error message is displayed.

Also, adjusted the mw.echo.ui.PlaceholderItemWidget to
accept a clickable link; when valid (currently only with
login error) the link is applied so the user can click
the notification and be taken to the login page.
For general notices (like API error or a general 'no
notifications found' message) the link does nothing.

Bug: T121923
Change-Id: I89a43c7c0eb2cf8e63d03704536e0938ab57dd4d
2015-12-22 10:34:01 -08:00
Moriel Schottlender a4659baec5 Add OOUI widgets for cross-wiki bundled notifications
* Add the ability to use bundled expandable
  notification groups
* Display bundled cross-wiki notifications following
  the design

Bug: T115419
Bug: T115423
Bug: T115422
Change-Id: I8c3eba6d627c3f06d51d74fc9774e3fc2d02915d
2015-12-14 17:22:34 -08:00
Moriel Schottlender 7d419bd128 Add a global overlay to Echo
This is preparing for nested popups inside the master popup.

Change-Id: I3bb86acd1bf841d5b27018565f5aa8f4a3295d9d
2015-11-23 18:47:57 +00:00
Moriel Schottlender 4bbaf77c2a Change the naming of 'notification option' to 'notification item' widgets
This is in preparation of adding more item models and widget types,
and in preparation of switching the notification widget away from being
a select widget.

Change-Id: I518fb3d80f4f67d677c21ca5593638269acfa544
2015-11-19 16:52:04 -08:00
Moriel Schottlender 24a8bc23ef Add a NetworkHandler as a central API authority to Echo
This is in preparation for dealing with cross-wiki notifications
where we may need several types of operations to extract bundled
notifications from local and external APIs.

Also, renamed files:
* mw.echo.dm.AbstractAPIHandler -> mw.echo.dm.APIHandler
* mw.echo.dm.APIHandler -> mw.echo.dm.LocalAPIHandler
* All API-related handler files moved to their own folder
  for better organization.

Change-Id: Ib730c780ea52c93a6026c5d0b22012b6f39bb50d
2015-11-19 15:25:03 -08:00