Commit graph

83 commits

Author SHA1 Message Date
jenkins-bot 8f7edc6901 Merge "Revert "Dim the title of current wiki if it has 0 notifications"" 2016-08-17 23:01:15 +00:00
Catrope 0e52416fcb Revert "Dim the title of current wiki if it has 0 notifications"
We decided we didn't want this behavior after all.

This reverts commit eadaac1c84.

Bug: T139646
Change-Id: Ib71f8000a59e66968c0fa161e3ab59b9ebdb3b1a
2016-08-17 22:51:28 +00:00
Moriel Schottlender 879ff56756 Log the mark entire cross-wiki bundle as read action
Bug: T127955
Change-Id: Iddff3592915c1f7d71622c1137abc725985fb3c2
2016-08-15 17:18:27 -07:00
Moriel Schottlender 951f146b54 Emit sortChange only for read/unread actions
Do not emit sortChange for toggleSeen, because every sortChange
creates a fake widget with a flipped 'read' state. There is no
reason to emit the sortChange event in toggleSeen anyways so it
is safer when only emitted in togglRead.

Also, make sure the controller always updates the correct seenTime
from the API when fetching local notifications. This was done for
the special page method but was overlooked for the fetching of local
notifications. For the most part, it shouldn't be affecting too much
because the SeenTimeModel is initialized with wgEchoSeenTime (which
is local) but updating the controller with the API response is the
safe thing to do, and will also cover cases where a tab was open,
notifications were seen in a different tab, and now the popup was
reopened in a "stale" tab again.

Bug: T143067
Change-Id: Ie261e32db28926d04fe14f7badd9d287ddc52749
2016-08-15 16:53:09 -07:00
jenkins-bot ccab1d8351 Merge "Log 'mark all read' button click actions" 2016-08-11 20:58:31 +00:00
jenkins-bot 65d4368860 Merge "Round timestamps to the day when displaying date titles in Special:Notifications" 2016-08-06 04:49:21 +00:00
Moriel Schottlender b02a6e8b26 Log 'mark all read' button click actions
The actions logged:

* Popup: Mark all notifications in the popup as read
  - Event ID is omitted
  - Context 'flyout'
* Special page: Mark all notifications in current wiki
  as read
  - Event ID is omitted
  - Context 'archive'

Bug: T127955
Change-Id: Id7c091f9e0cf0dd3745d33e335ab44706581d7f3
2016-08-05 13:33:47 -07:00
Moriel Schottlender 8d3b4fad2c Round timestamps to the day when displaying date titles in Special:Notifications
Bug: T141915
Change-Id: I5fcb78ac2fa168aa8bba90c467544fe3a6914ec3
2016-08-04 12:58:06 -07:00
jenkins-bot 2d390bad2e Merge "Add a footer notice inviting users to visit the Special:Notifications page" 2016-08-03 19:51:08 +00:00
jenkins-bot dedca66c8a Merge "Implement subject+talk and null+user page grouping" 2016-08-02 22:01:27 +00:00
Moriel Schottlender 75f6c11524 Add a footer notice inviting users to visit the Special:Notifications page
Bug: T141414
Change-Id: I6d9f9db62ecb85e70f72a9eb5a09e8ea1c8eebc2
2016-08-02 13:59:04 -07:00
Roan Kattouw 4e64643eb7 Implement subject+talk and null+user page grouping
Make it optional through the unpgrouppages parameter, so that
generic usage of the unreadnotificationpages API is still possible.

In the front-end, store which display title maps to what set of titles,
and pass in the full set rather than just the display title when
filtering by a page.

Bug: T137502
Change-Id: I443ca00ff5e5d36fd6910101226358942e6aa8ee
2016-08-02 13:48:48 -07:00
jenkins-bot 3be9a2e212 Merge "Update and fetch seenTime per source" 2016-08-02 19:57:12 +00:00
Moriel Schottlender 9e206ef8f5 Reduce number of prioritized actions in mobile
For mobile view, only display 1 prioritized action in the items,
and for general desktop view, stick to the default 2.

Bug: T141788
Change-Id: Ibf386ee598553ecfb717f07f02688034bbc338c8
2016-08-01 16:31:18 -07:00
jenkins-bot 9db03278b8 Merge "Fix fade-in/out animation in sorting" 2016-08-01 22:08:30 +00:00
Moriel Schottlender f4a955efe9 Fix fade-in/out animation in sorting
The fade in/out animation is asynchronous. This means that if we are
sorting multiple items one after the other, by the time the item faded
out, it will be reinserted back into the wrong position, breaking the
sorting.

This also broke the promise of OO.SortedEmitterList whereby all its items
are always in order.

The way to fix this was to force a better synchronization with the item
order while we hide and show the item in its new place. To do that,
a new widget is created as a fake clone of the old one, in the original
position of the old one. The original item is then reinserted (while hidden)
to the proper location -- preserving order. The fake clone is then faded
out, and the real item is then faded in.

For this to work properly, the cloned item had to preserve some of the
original item's information, like timestamp, foreigness and id. However,
since both the real item and the fake new clone have the same details,
the clone fakes its ID by adding a fraction to it - promising that the
fallback in case of equal timestamps (which happens on the real and
cloned items) will still resolve with some decision about the placement
of the items rather than (falsely but understandably) decide they are
both the same.

Since this whole animation is somewhat of a hack, the list now has a
configuration parameter to turn the animation on.

The animation is on in the popups, but off in the special page.

Bug: T141419
Change-Id: Ic7c35e5ddefc51bf7fde497eab36414b4dddcd9e
2016-08-01 13:49:10 -07:00
jenkins-bot 5f04fc334c Merge "Redo the notification badges" 2016-07-29 22:53:34 +00:00
Moriel Schottlender 1553a1a520 Remove 'mark as unread' from dotdotdot menu in items
Bug: T140517
Change-Id: Ie6c0f003239d4a683a1651df9470074668faa4eb
2016-07-28 15:47:42 -07:00
Moriel Schottlender 51331f318a Update and fetch seenTime per source
Also update the seenTime of the remote wikis when opening the
cross-wiki bundle.

Bug: T134855
Change-Id: I10510fc612f7d5349f8b579ede70be647a119470
2016-07-27 17:39:45 -07:00
Moriel Schottlender 9ab351352f Redo the notification badges
Bug: T115845
Bug: T140900
Depends-On: Ic666540d70de52f
Change-Id: I34e2736490319989a3a251a43fbe8080ab960b00
2016-07-27 11:51:05 -07:00
Matthew Flaschen c0a464e425 BREAKING CHANGE: More ISO 8601 for seen time
* Add ISO 8601 date format to notification output

  This is actually supposed to be the only output date format used,
  per https://www.mediawiki.org/wiki/API:Data_formats#Timestamps , but
  I'm not doing anything to deprecate the others right now.

* Change wgEchoSeenTime to use ISO 8601.  mwgrep and extension grep do
  not show any usages.  However, since it is a breaking change, to
  minimize disruption, I'm also using this opportunity to change
  'message' to 'notice'.

* Remove wgEchoInitialNotifCount.  I was going to also change 'message'
  to 'notice' here too, but then I saw it was totally unused.
  (It was read in Echo to populate a JS variable, but then it was
  unused.)

* Make sure the Special:Notifications page aggregation by days is
  done by local days, even though the timestamp per item is still
  UTC. This is to make sure the days are displayed correctly in
  the local timezone.

* Change all reverse sorting callbacks to handle comparisons of
  ISO 8601.

Bug: T141413
Change-Id: I20271345c7d350dc3e7f467288e5cdc98e6250cc
2016-07-27 02:42:08 +00:00
Moriel Schottlender 1dd3af10bb Adjust mobile view for the new settings cog menu
Now that we have the cog menu, it should be placed correctly in
mobile and the "preferences" link should be hidden.

Since MobileFrontend doesn't have the personal toolbar, and we
can't cheat by using jQuery and grabbing the url of preferences,
we have to get SpecialNotifications.php to output the urls
to a wg variable and reading it from there.

Bug: T115528
Change-Id: I6a69823d6f75c376c04e9a21d79916321e417178
2016-07-25 19:30:44 +00:00
Moriel Schottlender d739b89d77 Add a down indicator to the cog menu
As pointed out by Roan, this is the consistent way ooui elements
are displayed when they have a drop-down menu.

Change-Id: I36ecdd4cf6374dff34be15b24959548887788130
2016-07-22 15:06:28 -07:00
Moriel Schottlender 35a5384900 Change 'pt-notification-message' to 'pt-notification-notice'
And change all CSS and JS dependent calls/tags based on the new
tooltip message and ID of the personal tool <li> item.

Change-Id: I136fabe5710f90da10eb8d4afe92acdb77571eec
2016-07-21 11:19:17 -07:00
jenkins-bot e1b2823703 Merge "Add a mark-all-read button and a settings menu to Special:Notifications" 2016-07-21 14:04:39 +00:00
Moriel Schottlender 545d4e67ae Add a mark-all-read button and a settings menu to Special:Notifications
Add a global-wiki 'mark all as read' to the Special:Notifications page.
The 'mark all as read' will makr all notifications in the given
wiki. The context of the wiki changes when filters are chosen,
and so the message of the button changes as well.

Bug: T115528
Change-Id: Ibd9dcdf7072d6cbc1a268c18e558e6d0df28f929
2016-07-20 17:25:38 -07:00
jenkins-bot 1c7d93ba00 Merge "i18n: Native digits on PageNotificationsOptionWidget and PaginationWidget" 2016-07-19 21:53:38 +00:00
jenkins-bot 47de8691eb Merge "Show placeholder widget when there are no notifications" 2016-07-19 20:25:46 +00:00
Stephane Bisson c21c5cc821 Show placeholder widget when there are no notifications
When there are only foreign notifications, marking them all
as read empties the flyout completely. With this change,
we now show the placeholder widget with the 'no notifications'
message instead.

Bug: T132202
Change-Id: I7ee38b160ca03c08711670a3296ba4ab45a5eb6c
2016-07-19 20:14:39 +00:00
jenkins-bot 8b0dbd2031 Merge "Relate read-state filter and mark read/unread action" 2016-07-19 15:22:48 +00:00
jenkins-bot 060bc4e8b5 Merge "Fix truncation of notification headers" 2016-07-19 00:28:11 +00:00
jenkins-bot 184874473d Merge "Add tooltips to page filters" 2016-07-19 00:07:03 +00:00
Roan Kattouw d36c0ab123 Fix truncation of notification headers
We need a fixed-width CSS table with a number of fixed-width
cells and one cell that takes up the remaining width, with
text truncation. This is a pain to do with CSS tables,
but this trick I found on StackOverflow[1] works well:
wrap the contents of the cell in a div that's position: relative;,
containing another div that's position: absolute; width: 100%;

[1] http://stackoverflow.com/questions/7569436/css-constrain-a-table-with-long-cell-contents-to-page-width

Bug: T140349
Change-Id: I507f915f06185c767d7a5c8edbff6c341e07b6e2
2016-07-18 17:06:48 -07:00
Moriel Schottlender 5aaf6d26d8 Relate read-state filter and mark read/unread action
When we are viewing a certain read state filter ('read' or 'unread')
the visibility of items should correspond to that state even when
the user marks a specific item as read/unread. That means that the
system should remove these items from view when the action is taken.

In this commit:
* The controller makes the judgment of whether to remove items when
  read/unread action is taken, based on whether a filter is set.
* We clean up the terminology of discard - no more 'remove' - to
  make sure we have consistency in the code.
* Related: The 'discard' event is now scoped within the hierarchy;
  meaning, lists emit 'discard' when an item is removed, grouplist
  emits 'discard' when a group is removed, and the manager emits
  'discard' when an entire notification model is removed. This
  means we can actually have proper hierarchy and organization with
  a single event, and not worry about clashing between the intentional
  'discard' action and the event 'remove' that is also used while
  resorting happens.
* The model manager emits a discard event when a model is removed
  so that the general list can listen to the manager and remove an
  entire batch of items if needed.
* The pagination model now updates the count for the current page
  rather than some vague notion of the last page. This is also
  updated when the controller removes items, so we can get an
  accurate count in the page for the number of notifications that
  are displayed.

Bug: T136891
Change-Id: I247c618042ef256fadf09922f7b83bd1ad361f64
2016-07-18 13:23:57 -07:00
jenkins-bot d27cab59d6 Merge "Add a SeenTimeModel to handle seenTime in sources" 2016-07-18 13:01:35 +00:00
jenkins-bot 9352ce9756 Merge "Dim the title of current wiki if it has 0 notifications" 2016-07-15 19:09:43 +00:00
Moriel Schottlender eadaac1c84 Dim the title of current wiki if it has 0 notifications
Bug: T139646
Change-Id: I827cb43d5badd0a13666226691450a73ddcc85ea
2016-07-15 11:42:47 -07:00
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 7660732bb7 Fade in/out elements that are moved in the notifications list
Bug: T126214
Change-Id: Iad5df1f56bfbd12cb6f42dd6e73860bdcc27cd68
2016-07-15 18:04:49 +00:00
Ed Sanders f000a82c1d Fix messages/notices documentation
Bug: T139682
Change-Id: I453b7377c13ca172774e103c1f097423bf68e9b2
2016-07-14 13:45:23 +01:00
Moriel Schottlender ac5c9c17f8 Prevent click propogation when clicking 'mark as read' button
Bug: T139339
Change-Id: I3a19a0d01b036fe3c0379e3a5bc0c3f0e5f9473e
2016-07-13 11:30:55 -07:00
Stephane Bisson 35e782c3d8 Add tooltips to page filters
Bug: T139644
Change-Id: I6ae0d0e8c6c7dd79b9ab00db1d601f670764d3a4
2016-07-13 09:51:51 -04:00
Ebrahim Byagowi 4eba4c1dd0 i18n: Native digits on PageNotificationsOptionWidget and PaginationWidget
Similar to Icdd52ea0267ffbaa0e103070655735eff8423ca1

Change-Id: I8667fc8b7027d2c9c8b42155a7b79ef18500dc2b
2016-07-09 07:52:23 +00:00
jenkins-bot 152bd3e622 Merge "Store local source as 'local' rather than dbName" 2016-07-08 14:27:51 +00:00
jenkins-bot 28aca00dce Merge "Properly aggregate the itemUpdate event" 2016-07-08 14:16:20 +00:00
Moriel Schottlender 4b137b3208 Followup Ib7f4dc4ea: Bring back message tooltip with 'notice' text
The message for tooltip-pt-notifications-message was removed to comply
with the new naming. The problem is that in the back end, sections are
still defined as 'message' vs 'alerts' and the sections in the user
toolbar are defined with those terms. In no-JS mode (which is before
the user clicks any of the badges) this tooltip is created automatically
by MediaWiki based on class names.

It's easier to return the message key with different text for translation
and wait for the bigger tech debt to correct all instances of 'message'
to 'notice' (including in the API, which would require a much more
massive work)

Bug: T139520
Change-Id: I6368b63e38f64aa065f2580df812de1c63a93716
2016-07-07 17:09:18 -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
Moriel Schottlender fcd2f41151 Store local source as 'local' rather than dbName
When we fetch the pages per wiki, the API returns an object that
defines the local wiki we are in as its dbName; this then gets
stored into the model as the source, which forces us to check against
the dbName whenever we want to perform an operation so we can tell
the API layer to fetch and perform the actions locally, rather than
use a foreign API.

The term 'local' makes no sense for naming the model (and upcoming
tech debt work will fix this) but it makes sense in the context of
the API layer -- and hence, the source name should follow suit.

This fix makes sure that the local wiki objects always have their
sources defined to be 'local', and thus making us use the test for
dbName in very specific points (when we get the data) rather than
throughout the codebase, randonly.

This is also the first step to allow proper updating of things like
seenTime accross wikis, especially in cases where we view a remote
wiki as if it is local (in the Special:Notifications page)

Change-Id: I94633a1cd074580cbc5029d7c75d179e908e5c52
2016-07-07 12:20:39 -07:00
Moriel Schottlender 5c81ac8d3b Properly aggregate the itemUpdate event
Instead of 'cheating' and externally aggregating the itemUpdate event
we should just let the relevant (non-xwiki) models aggregate this
centrally and properly, and include it as an offered event.

Change-Id: Ibe528fe971e1be8309a97275b1a1be8979306ff5
2016-07-07 19:08:47 +00:00
Stephane Bisson cead7142c7 Fix mark xwiki as read
Marking local or xwiki notifications as read
are different operations that require different
information. Call different functions on the
controller.

Bug: T139114
Change-Id: I824ca668c31ab41d101c632442c91d3a8a1e5c5a
2016-07-04 10:00:59 -04:00