Commit graph

23 commits

Author SHA1 Message Date
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
Moriel Schottlender 02530f19e1 Implement SortedList in Echo notifications
This is especially important for combined notifications and
notification lists from different sources; the model list should
be sorted to reflect items by timestamp and unread status.

Note: The dm.List and dm.SortedList now mirror the structures
OO.EmitterList and OO.SortedEmitterList that are awaiting to be
added for oojs in Ib94e4e4a49 and  I3fd569691549 respectively.
Once those are available, the dm.List and dm.SortedList can
be removed, and the model can mixin OO.SortedEmitterList instead.

Change-Id: I97e1ecbe5dccc478be527a94f037500f78f74b14
2015-11-06 11:01:10 -08:00
Moriel Schottlender f4deb6829c Allow notification model and widget to show combined notifications
Make sure it's possible to create a combined notification widget
that features both alerts and messages.

Change-Id: I4b3f263039f54430a61acc1a261d8aca8e894a90
2015-11-06 18:50:06 +00:00
Moriel Schottlender 466858bbe8 Add an APIHandler to Echo notifications
This simplifies the operation of the API a bit, but more importantly
this will let us create a demo where we can manipulate the API result
and test various new notification formats while the work on the
backend API responses is ongoing, and also will allow us to have a
constant test for all notifications types, including backwards
compatibility.

Change-Id: I6081329a287cda4f5f1f1604ace5d04ff8d9fe3d
2015-11-05 10:50:03 -08:00
Moriel Schottlender c3787f4c51 Don't mark read notifications as unseen
If a notification is already read it is by definition seen. Don't
mark those as unseen. This can actually happen if our seenTime is
invalid (like a cache miss)

Change-Id: Id943691599116597b6c68d2cc40e7b89a25ce05e
2015-11-03 15:34:09 -08:00
Moriel Schottlender c4ad851fc3 Prep for mobile rewrite in Echo
Fix event documentation and add mobile target for ext.echo.ui

Change-Id: I86131293ec83359fa2dc6eaccf35a2824e0cf051
2015-11-03 14:51:20 -08:00
jenkins-bot 14a5bc371d Merge "Add browser test for notifications in Echo" 2015-10-13 17:29:02 +00:00
Moriel Schottlender 8b2c6355cc Add browser test for notifications in Echo
This browser test checks that mentions go to alerts and talk page
messages go to messages popup. This also upgrades the MW-Selenium
version in Echo tests to 1.6.1.

Depends on MW-Selenium version 1.6.1 (See T114061)

Bug: T113081
Change-Id: I40a17500cdfb838420c04dc0b9268ba56515cc2c
2015-10-04 22:23:51 -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
Moriel Schottlender 29e7bd568d Add a comment to counting unread page notifications
Change-Id: Ic2cd5e06ddf926da9fe9c924e5f46e0e4601fde9
2015-10-01 13:35:35 -07:00
Moriel Schottlender 55e9d8e819 Remove orange bar when all talk notifications are read
Don't just remove it when all notifications are read, but when all
specifically talk notifications are read even if there are other
unread notifications in the popup.

Change-Id: I5aa65a4060d64f374b47fe91d8e53c92ded5fab2
2015-10-01 10:56:40 -07:00
Moriel Schottlender 8bc0c98b6f Remove talk page notification bar if all messages are read
Bug: T106033
Change-Id: I5133896c204be701e0fae582af91c906175f39d1
2015-09-21 12:06:34 -07:00
Moriel Schottlender 0e02fb2cde Update the API when a single notification is marked as read
The status changed internally but was never passed to the API.
This commit fixes that mishap.

Bug: T112826
Change-Id: I1a6d2a871eae837860eb1f21df28134d5e747cd7
2015-09-18 16:05:35 -07:00
Moriel Schottlender fd0aed5ae4 Handle API fetching errors
Bug: T112251
Change-Id: Ifb9c63cd056b0cc0e7076c73e98155cef445038f
2015-09-17 15:03:28 -07:00
Moriel Schottlender c5905962ab Only load ext.echo.ui if the user clicks the echo badge
There is no need to load the entire of Echo's ui module (especially
since that includes ooui widgets and their styles) on every page load.
There's only need to load the entire module if and when a user clicks
the Echo notification badge.

Also, make the echo.dm model accept an external fetchNotifications
promise so we can send the API request alongside loading the echo UI
and "feed" it into the DM for processing.

CSS adjusted to make the "jump" between the nojs and the js buttons
seem less jumpy.

Bug: T112401
Change-Id: I516e655ffd198511d694489a0702c5c713a5fd68
2015-09-15 17:11:46 -07:00
Moriel Schottlender b1b9b6e257 Don't clear notifications when refetching
Make the popup header the pending element to give the user a visual
indication that the notification widget is being updated, but don't
clear the notifications before loading more from the database.

Bug: T112186
Change-Id: If2b724fab07ef5b7caf5cab3e44fe326470ac0e7
2015-09-10 15:24:21 -07:00
Moriel Schottlender 7310a6b387 Show unread notifications first in the popup
Change-Id: Ib4947cee84a28a2850a86032528fa75bf472c5fa
2015-09-08 13:57:00 -07:00
Moriel Schottlender ea1f23e04d Don't wait for the API to update seen status of notifications
First update the notifications as seen, then send the api request
for updating the seen time. Update the actual seen time from the
api response so the time is always in sync with server time.

Change-Id: I97717cfda7b665dcbc3add90712069700f44adf6
2015-09-03 15:06:14 -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
Moriel Schottlender f6a12f1051 Correct 'primaryLink' to 'primaryUrl' everywhere
Change-Id: Id42940460f7825541f9bc6e65ff864035591f47e
2015-09-02 16:59:55 -07: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