The current initial message in the button label is "Alerts (x)" or
"Notices (x)" but when the badge loaded, we changed that to only show
the rendered number. This is inconsistent; the badge should always
update the label properly, even if it's not visible in most cases.
Bug: T173970
Change-Id: I6a5e13fc36ddb1bf467c712fcf49af3b18e582d0
Docs (especially in EventPresentationModel.php) say true means outside
the menu, false inside.
However, it was interpreting any non-undefined value as true.
Change-Id: Icb438538e5c588c1ac7d4bbac0b762dd07057199
To support accessibility, make sure the titles in Special:Notifications
are <h2> headings.
Bug: T149955
Change-Id: I4f15694efb04896e9bd7b026d297891047759644
Just show the textual "Alerts (1)" and "Notices (1)".
Updated NotificationBadgeWidget to use that internally as label,
same as the PHP-generated list item does after d4d325e7.
Bug: T141944
Change-Id: I468c67b0866530e21c9af32cd02816075a3693a1
The event should fire after the count actually changes in the
DOM as well as the internal workings of Echo.
Change-Id: I03f1742b209305080af8784632f07dff63135d81
Separate the behavior of promise vs event when changes happen and
we need to clip the popup. The popup should only clip itself after
the DOM has finished populating, not "just" after the model has
been populated with data.
Adding an event that triggers whenever the main list changes anything
that is in its DOM, and having the badge widget trigger a popup clip
will solve this issue and untangle the expectation of the promises
vs. the widgets populating themselves through the events.
Change-Id: Iff9996eb1810e7ade135359139e16837e6dc74f0
Move unread counter to the left (or right, in RTL)
when it's longuer than 2 characters so as to
have harmonious spacing between the counters and
the next link on the toolbar.
Bug: T142454
Change-Id: Ib8aa673cf9e60ade80490ea0eccb7453d3747cd0
Added the following Javascript hooks:
* ext.echo.notifications.beforeRender: Firing before a group of
notification widgets are rendered, whether in the popup, in
the special page, or in a cross-wiki bundle (which requires
async loading)
* ext.echo.badge.countChange: Fired when the badge count changes
with the notification type, count and the label count for
display purposes.
* ext.echo.popup.onInitialize: Fired when the popup is opened and
after notifications were fetched, with the context of the popup
notification type.
* ext.echo.special.onInitialize: Fired when the special page is
ready and notifications were fetched. Note that it will be fired
whenever the special page is updated with notifications list,
as well, like when changing filter, remote wiki or pagination.
The hooks were also documented in hooks.txt
Bug: T146296
Change-Id: Ie3dc97f97e8d1f90b67f62fcdc65dd29cb379aad
Unfortunately there's no generic support for using colors for icons in
OOUI yet, so we have to copy what OutlineOptionWidget does and
override setPressed()/setSelected() to add/clear the progressive flag.
Also reintroducing colors for text which are aligned with icons on
the different states and use transitions.
Change-Id: I07cf4011d28c1db4eefb451367e29c271b5efaeb
This transforms seenTime concept to a global property for all wikis
and sources, and updates the global seen time on opening the popup.
Bug: T134855
Change-Id: I67bcc4b346237317c7a9204dd43cd0e9ee02792f
Also, make sure that the bundle follows the same behavior as the
xwiki bundle, where if it does not have a primary link, the 'click'
event triggers the 'expand' action.
Bug: T145902
Change-Id: I456bf76a7bd531ffcad5462708f37cd54d8af99d
Has bugs, and will likely cause deployment problems.
This'll need to be reverted in wmf.19 at least
until we fix it up.
This reverts commit 00e0b9f45d.
Change-Id: Ia9d220ebcb607f96dee6bc856755305ed8501fcc
Some of the counts are capped (wiki counts) and some are not (page
counts) - so we are adding a config option ('isCapped') to the
widget to make sure that capped numbers appear with the proper
i18n message ('99+' in English) and non-capped numbers appear
as-is.
Bug: T144707
Change-Id: I7332e7f5108621d0bd403edefe4feacca44b1f88
This follows the generalization we made in the back-end and allows
us to always use the same method to get capped notification count
in the display.
Bug: T144707
Change-Id: I4d7f406b05a195972dca0d2088bde2ff739d313d
These numbers are already "capped" for display as 99+ after they pass
100, so we should use this message for proper display.
Individual page number counts are not capped (they are accurate) so
they can remain the same.
Bug: T144707
Change-Id: Iecb877c11e2f372d58f4fc926119dbf3b316e825
- Add a 'hasUnseen' data to the xwiki bundle so the badge can
consider its value when changing its color even without the
bundle being opened.
- Check and store seenTimes from all sources that the xwiki
has in a new JS object that the SeenTimeModel can store
Bug: T134855
Change-Id: Ifdcee88b4378cdc7acb4ae5c0cbc60b76339757e
Mainly used for mobile actions, and should be appended to the
overlay - this widget assumes it should appear and then fade out
with some confirmation message.
Also moved 'doubleCheck' icon to the ooui definitions, including
an inverted icon that is necessary for this widget.
Bug: T141404
Change-Id: I67a44962eaee6b7bd8cac26dcb5277177fa5d224
This is necessary to preserve backwards compatibility for the API, and
this also fixes the no-JS special page.
Also, fix additional warnings.
Change-Id: Id603b4ab22c69097d5559a756bec72a6ba785661
Allow extensions to add dynamic actions that perform some
API request and display a confirmation message.
Bug: T132975
Change-Id: Ib16d57c3f1a11a9749564c6e2112bf1ca32c55e8
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
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
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
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
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
* 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
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
As pointed out by Roan, this is the consistent way ooui elements
are displayed when they have a drop-down menu.
Change-Id: I36ecdd4cf6374dff34be15b24959548887788130
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
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
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
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
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
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
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
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
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
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
If there are more than 2 prioritized actions, put those actions
in the dotdotdot menu.
Also, correct the name of a variable from "isInsideMenu" to what
it actually represents, which is, in fact, "isOutsideMenu"
Bug: T126617
Bug: T125949
Change-Id: I95fcae8f822e51d9353599c09f1550797e4ad673
If we are marking the item as read/unread, we don't want the change
in class to trigger the unseen animation. When that happens, first
remove the 'initiallyUnseen' class (that triggers the animation)
and only then mark the item as read or unread.
Bug: T138522
Change-Id: I05e02518feb1fc166297594053a084718dcb7194
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