Commit graph

39 commits

Author SHA1 Message Date
Roan Kattouw 877e621a6a Fix various bugs in mw.echo.Logger and its callers
* Fix typo that caused logInteraction() to never do anything
* Fix incorrect context parameter passed by NotificationBadgeWidget
* Consistently use mw.Echo.Logger.static.context.* constants for the
  context parameter everywhere

Bug: T114833
Change-Id: I140e4222169ad9e78c6bf016d9765828513adcbb
2015-10-08 15:20:31 -07:00
Roan Kattouw cacccc307a Follow-up f9e8c5057, 983c7a2463: fix JS error when there are no notifications
We have to account for the placeholder item, which doesn't have a
getModel method. We should ensure the real items and the placeholder
item implement a common interface so we don't need these kinds of
checks all over the place.

Bug: T114853
Change-Id: Iff6f0e85fb7737e09a34e72038b6b41681d95595
2015-10-07 08:20:35 -07:00
Roan Kattouw 983c7a2463 Follow-up f9e8c5057: fix JS error
Bug: T114833
Change-Id: I73d37a0688165125db56c1d6c088f215b19f421e
2015-10-06 18:24:14 -07:00
Moriel Schottlender f9e8c5057c Log notification impressions and clicks
This logging was taken out by accident during the split notifications
rewrite.

Bug: T114833
Change-Id: I7672c20bb12e06f3efc63763aacbe81fd0f34ece
2015-10-06 23:15:56 +00:00
Moriel Schottlender f6c9e68577 Mark notifications as automatically read only after the popup loads
We've corrected this behavior for updating seenTime but not for setting
the notifications as read if the widget is configured as
'markReadWhenSeen' which produced unexpected issues with updating alerts.

This is fixed in this commit.

Change-Id: I4d2420a81d2b8409749ad1621b2d56bdd14e8c6e
2015-09-30 11:42:53 -07:00
Roan Kattouw d15615ea89 Close popup when badge is clicked
Bug: T114106
Change-Id: I9c1e9bb9826bd301bff8f80bedee011184843f72
2015-09-29 17:02:48 -07:00
Moriel Schottlender e0cd881aeb Mark all read button should always start invisible
Whether the button should appear or not is updated when the badge
is updated, based on having unread notifications. But during construction
the button should be hidden.

When we do update the badge, the button should only appear if there
are unread messages and if the current widget is not 'markReadWhenSeen'
to avoid having the button 'flash' while notifications are marked
read.

Bug: T113629
Change-Id: I002db9e3d8990b5a2cd67bf5d120b1c7eb454362
2015-09-28 20:37:01 +00:00
Moriel Schottlender 3ea86361a4 Rewrite browser tests for Echo
The new oouified echo popup makes the tests invalid; this commit
rewrites those tests.

Also by doing this commit we are upgrading to Selenium 1.4.

Change-Id: I26215558768d55be449276c55b4b745c3a458ecb
2015-09-25 15:50:59 -07:00
jenkins-bot a206bdd9ef Merge "Make middle-clicking badge work" 2015-09-24 23:16:07 +00:00
Moriel Schottlender e664cb220f Update seen time only if the popup is actually open
The notifications can be populated from the popup and outside of it.
We should update the seen time only if the request came from the popup
itself, and only if it is still open by the time the api request
has finished.

Bug: T113645
Change-Id: Id91ddabb85fd582be1890ea420d0559e0cdca167
2015-09-24 14:23:23 -07:00
Roan Kattouw 6efd060169 Make middle-clicking badge work
* Ignore non-left-button click events on initial badge
* Pass href into OOUI badge widget

Bug: T113555
Change-Id: I963aa5193435c46075df6d7204de335b51ecffd4
2015-09-24 10:35:55 -07:00
jenkins-bot 286aab802d Merge "Remove 'initiallyUnseen' class when the popup closes" 2015-09-24 01:37:37 +00:00
Moriel Schottlender 9514aa01ab Remove 'initiallyUnseen' class when the popup closes
The popup automatically updates itself every time it is opened.
If there are unseen notifications, they should be updated when the
next fetch happens, which means we must take off that class so
that the animation doesn't repeat itself.

Change-Id: Ib4173631efa1c5a3a3509e0797e60397397bd009
2015-09-23 16:58:57 -07:00
Moriel Schottlender c4485b91a7 Prevent the badge icon from flashing red when updating notifications
If the popup is open, whatever is coming in is immediately 'seen',
so we shouldn't flash the badge as red.

Bug: T112823
Change-Id: I9fe78ed11506de3c82043141f994e1ca96c5880b
2015-09-22 17:24:58 -07:00
jenkins-bot 32d8991013 Merge "Move timing.MediaWiki.echo.overlay stats into ext.echo.init" 2015-09-22 21:41:03 +00:00
Kunal Mehta c8eea64259 Move timing.MediaWiki.echo.overlay stats into ext.echo.init
We really only care about measuring the timing of the first click,
because that is the one that loads OOjs UI and fires an API request.

Bug: T113387
Change-Id: Ib37d31b07c45d546c75251a57a848e3ae0f4bf1b
2015-09-22 12:04:35 -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
jenkins-bot 61158920f8 Merge "Replace entire <li> element to produce button and popup separately" 2015-09-19 15:59:19 +00:00
Moriel Schottlender 429b11148b Replace entire <li> element to produce button and popup separately
We need the button to remain a standalone <a> element so it preserves
the exact same styling as the output we're getting from the PHP. the
only way to do this is to create the widget as the entire <li> and then
replace the original.

Bug: T112218
Change-Id: Ib6fd4369d46cb7f37b14675d63bbce9950abcd48
2015-09-19 17:56:29 +02:00
jenkins-bot 1b590d4308 Merge "Show a default message if no notifications are available" 2015-09-17 23:52:48 +00:00
Moriel Schottlender 1474a21d4a Fix a code comment to make it much clearer
Change-Id: Ibd7c1e050f0d0790c1712a950568e3f9b09965ca
2015-09-17 16:43:36 -07:00
Moriel Schottlender 5e8e18ee48 Show a default message if no notifications are available
Bug: T112251
Change-Id: Ia17c50a11ea0a49041795332ba79bd3cbda5b548
2015-09-17 16:25:54 -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
jenkins-bot c73d29e324 Merge "Don't clear notifications when refetching" 2015-09-12 10:51:17 +00:00
jenkins-bot 892b3d7a8c Merge "Use localized numbers in the badge" 2015-09-11 13:04:45 +00:00
Kunal Mehta 7ae462f5e4 Use localized numbers in the badge
Bug: T112224
Change-Id: I6df892bf92f5de0e0552a7b12c9799be640839bc
2015-09-10 21:29:56 -07:00
jenkins-bot 34e1ffa59a Merge "Restyle buttons to be fully clickable" 2015-09-10 22:43:31 +00:00
Ed Sanders 1301a8f3f9 Add constructed class and messages names in comment for greppability
Done in one place but missing in two others.

Change-Id: I671326c05e15dfad1fca06f66d6847fcca0c2737
2015-09-10 23:38:26 +01: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
Ed Sanders 48dc79be11 Restyle buttons to be fully clickable
Also use framed buttons (which these sort of are) as they
have hover styles.

Bug: T112188
Change-Id: I750a18a90c655cc7916e050b5e300300a4437b69
2015-09-10 23:08:33 +01:00
jenkins-bot d36f940f06 Merge "Align popup footer buttons to take 50% width each" 2015-09-09 20:47:50 +00:00
Moriel Schottlender a37e764d3d Align popup footer buttons to take 50% width each
The alignment of the buttons was done haphazadly before, using
padding. This should be done better; we should calculate the buttons
width to be 50% of the width of the popup.

Since the popup accepts a width config, we know what its value is,
and can calculate the proper width. The width was added to the
variables.less file for continued use.

* Added popupWidth config variable to the badge widget
* Added OO.ui.ButtonGroupWidget to place the buttons in for
  consistency and styling
* Added calculated width styles to both footer buttons
* Added corrections for MonoBook

Change-Id: Iad2c947da06241e9303cf1f35574177a0f602bbb
2015-09-09 13:37:24 -07:00
Moriel Schottlender 71999b28c4 Only show 'mark all as read' AFTER there are notifications
Hide the 'mark all read' button while we fetch notifications.
We can't mark all as read before there are any actual unread
notifications in the popup anyways.

Change-Id: I38ace6a3f8b7898bdcd82ce650947f0c7ef319e2
2015-09-09 11:50:54 -07:00
Moriel Schottlender 73e3ed3717 Add a tooltip to the notification badges
Since the nojs "base" version uses the automatic title creation
of the personal tools, the message keys were adjusted accordingly,
and the old unified message was removed.

Bug: T108190
Change-Id: I1f242f530aa68562aa4dc885156586c22c4df618
2015-09-08 14:03:34 -07:00
Moriel Schottlender 2ec0ccad78 The return of the 'mark all as read' button
For some reason during the readjustment to the model/view the
mark all as read button was not toggled when it should have been.

It is now.

Change-Id: I05c32e9cb02e94b4e3dc3e2bcd9cead0eb802015
2015-09-08 13:46:57 -07:00
Moriel Schottlender f4fd809e56 Only send api request if the popup is opening
Listen to 'toggle' instead of onAction so we can only send api
requests for notifications if the popup is in the process of opening
and not when the button is clicked to close the popup.

Bug: T111667
Change-Id: I39aea942ff5a87a13043cccdb696ef8952ca61db
2015-09-07 17:11:31 -07:00
Moriel Schottlender 36191fc290 Fix the badge icon update
Make sure that when the seen state changes, the badge icon adjusts
in case there are two different icons for seen and unseen states.
Also organize a bit the unseen/unread status in initialization.
And separate and update the icons in the popup head to always fit
the status and icon of the badge.

Bug: T111432
Change-Id: I891a36c6eace9302b370a3efaf5aa6f57192c17f
2015-09-07 12:05:14 -07: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