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
Changing the way Echo's front-end architecture works to work with
model-view-controller methodology.
Change-Id: I97862402c41bc04dd41cd08d79f19ff677340249
Also, get rid of the feature where we hide the project name when there
is only one project available. The titles are always showing.
Bug: T127419
Change-Id: I1b1285d84b7fb4775d13067e6ae1c50602ed3baf
Foreign notification sources can end up being empty
for legitimate reasons (already marked as read on the
foreign wiki) or errors (failed to query remote server).
This change makes the front-end resilient by
removing the sources if they end up being empty,
and removing the foreign notifications bundle if
all the sources end up being empty.
Bug: T135252
Bug: T135250
Change-Id: I5901bb0007420a19d8c0727faa982eb00809c074
Some complexity is now gone. We didn't currently have a good justification
for a the APIHandler factory: the apiHandler caller would have to specify
(variable `foreign`) what kind of handler it would like to initiate anyway,
so it might as well just inject the object (which makes the code easier to
follow, decreases bugs risk because there are less code paths)
This also gives the caller more control of the API handlers:
registerForeignSources will now be able to do more. Now it can e.g. create
1 object that is shared for multiple wikis (to do lookups for multiple
wikis at once)
Also renamed addApiHandler to setApiHandler (it just sets the value it needs
without checking if it already existed anyway)
Change-Id: Ie1814c5bf1a1f0e5607033beb506df67f3585b24
this.api is used in APIHandler.createNewFetchNotificationPromise,
so we should make sure it always has a valid this.api
Change-Id: Id476661fb427adbbb3c5741737c293c32ad8a27e
Allow marking notifications as read per 'section' (days) in the
Special:Notifications page.
Bug: T115528
Bug: T134204
Change-Id: I7324a2c693aa92b9327cf8ff98f125293d5fba10
Fetch cross-wiki notifications by asking the local API, but still
maintain the ability to send remote requests to the foreign wikis
for mark-as-read operations.
Bug: T130636
Change-Id: I48524cb9dff43257a401d7483e939edfb042b928
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
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
I thought the name was confusing, and would be even more so
if we get real notifications from other sources.
Meanwhile also split $crossWikiSummary into 2 properties:
- 1 with the class
- 1 to indicate if it should be used
Change-Id: I0e83be7924c8c77680ea1ada3f2bd6a190ce6149
This would soon become problematic when output can come from
multiple sources, with potentially conflicting ids.
The ID is already included in the result anyway.
Change-Id: Id92150c71c68958819fe0ee329e70393052c34c9
It's (mostly) unused, and it would become problematic once we have
notifications from multiple places (where those ids could conflict)
Change-Id: Ib3bb5ae1e5689037b38290c9ce3d8691f52582b0
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
min-width and min-height are now set on icons. This breaks the ability
to scale icons down, so override these rules.
Change-Id: I6372f0fe17ccfd853bde497730c49cbcf9f89a41
To implement this, use PopupButtonWidget and override to handle hover
in addition to click.
Bug: T128937
Change-Id: I79f5bb5839491516b0a3f77630b481cd6c2cc3da
If we don't do this, the footer becomes slightly taller
when the image loads, which makes the popup clip incorrectly.
Change-Id: Ica84d704692676d884b847f8fe01c49319f04931
We were using momentjs here before (causing bug T123845),
but we switched to using a hack for short timestamps.
This hack didn't call convertNumber(), so we stopped performing
number formatting for languages that don't use Western Arabic
numerals (0-9).
Strictly, that regression "fixed" T123845 because it caused
0-9 to be used in all cases, including the case that that bug
asked for. This patch fixes the regression but preserves the
desired behavior for arwiki, since convertNumber() respects
$wgTranslateNumerals.
Bug: T123845
Change-Id: Ic9acb12f534e0f049e22577afe276f8bf68f691d
This caused notifications on mobile to show notifications for
both alert|message, as the type was always "all".
Bug: T130801
Change-Id: Ice245eb407ca360d8e882c0ba48cb7b3e0ecb851
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
Hover effects aren't the only thing that cause link underlining,
the "Underline links" preference can do this too.
We do still need the :hover selectors too, for specificity reasons.
Bug: T130793
Change-Id: I01c0eaee449470380f3bd752e509043c4580fea9
Followup to I7891eb3fb46b3 this should be merged only after
the changes in MobileFrontend in Ie592ca738ac2d82 are merged.
Change-Id: I0f28e0757170e8a5b12075d3e9a2343fea7e7155
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
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
Both in the order of the cross-wiki bundles themselves, and
in the message in the notification body.
ForeignNotifications tracks timestamps per wiki per section,
and exposes these through getWikiTimestamp(). ApiEchoNotifications
adds these timestamps to the sources manifest, and also sorts
the list of wikis by timestamp (it'd be nicer to do this in
ForeignPresentationModel instead, but then we'd have to create a new
ForeignNotifications instance which causes a duplicated DB query).
NotificationsModel receives the timestamp for its wiki as its
fallback timestamp, and makes getTimestamp() return this value
during the pre-population phase. This causes its parent to
automatically sort it correctly.
Because the timestamp of a wiki depends on the section (alerts vs messages),
we can't put it in the global sources manifest at the top level
of the API response. Instead, get rid of this global sources
manifest and put all the sources data in the foreign notifications
directly. This allows us to specify different timestamps, and also
allows us to get rid of code in EchoApi that was already remapping
the API response to this format.
Bug: T130298
Change-Id: Ie083fbb1ccaf74fbe804633d87ef03c9e71b120f
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
FloatableElement incorrectly believes it doesn't need to
position itself when its closest scrollable is the same as
the closest scrollable of the container. This causes
the dotdotdot menu to be placed at the top left of the screen
if the notifications popup is not scrollable. If it is scrollable,
everything works fine. This regression was introduced by I5b5d7936c4d.
Work around this by setting overflow-x: auto; on the popup body.
This is a no-op, but tricks OOUI into thinking that the popup
body is scrollable even when it visually isn't. We can't use
overflow-y for this, because we still need to set overflow-y: auto;
on the popup body to work around a Chrome bug where right-floated
elements don't move over when the scrollbar appears.
Bug: T130153
Change-Id: I8bd8a26a4931444a760d2159779240272c51f966
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
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
We have a wrapper around logInteraction() called logNotificationImpressions()
that logs impressions uniquely (i.e. logs each notification impression only once),
but in addition to calling that (from NotificationsWidget), we were also manually
calling logInteraction() to log impressions from NotificationBadgeWidget
and NotificationGroupItemWidget. This resulted in two impression events
for every notification, each with different data, one of which is logged
only once and one of which can be logged multiple times.
Remove the manual logImpression() calls and route everything through
logNotificationImpressions(), which is called from only one place:
NotificationsWidget. Add support for logging foreign wikis to
logNotificationImpressions(), as it was previously missing.
This causes us to lose the notification type information in these
events, but that can also be derived after the fact by looking
up the event_id in the echo_event table.
Whether impression logging is even useful is another question,
but it certainly isn't useful if we log duplicate impression
events with different data.
Change-Id: I19b76a4ce796b21e9347dd9392af24918db82e18
Skip foreign bundles on 'mark all as read' operation, and mark as
read the items available in the popup.
Bug: T128621
Change-Id: I431b1ea94ab1c4942bd3de38753f113a4e2ae22f
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
Use 'm' instead of 'minutes', 's' instead of 'seconds', etc, for
shorter timestamp rendering in the notification list.
Bug: T125970
Change-Id: I9479c5406a4bf44ef560bef2c8f204a9f60cafc6
This whole class is a terrible hack, and we should instead implement
a proper facility for what we need in OOUI.
Bug: T128436
Change-Id: I8777a6e36d238dc13c9060b74b7a72c6933082f6
07c5850b changed the widget used for the "mark as read"
menu item from OO.ui.ButtonOptionWidget to mw.echo.ui.MenuItemWidget.
While this makes sense, it also broke its functionality, because
mw.echo.ui.MenuItemWidgets are unselectable so if you click them
the 'choose' event isn't emitted.
However, we also can't make these widgets selectable, because
that breaks the links inside these widgets (the containing MenuSelectWidget
intercepts mouse events and prevents default). So instead,
make mw.echo.ui.MenuItemWidgets only be unselectable if they are
links (have config.url set), so that both use cases work.
Bug: T128432
Change-Id: I8374e3ae61a005ec7d25c2eb95b1391cbb191d60
Use dir=auto instead of wrapping in <bdi>.
They have the same effect, except that the latter produces
strange-looking truncation behavior with LTR body text in an RTL
interface because text-overflow: ellipsis; is set on the <div>,
not on the <bdi> node.
Bug: T127407
Change-Id: Id58a70f5b88a10c827e61d9e16aae1a81938709a
* Transform the action bar to table layout even in non-bundle
notifications.
* Increase the padding on the side for consistency
Bug: T125909
Bug: T125969
Bug: T126686
Change-Id: I26ba5b7a21a1f36774749154d3f95d61254c5ce2
The toggle-collapse process should be applied only when we click the
actual notification content/body and not the bundle items. This will
make it possible to middle-click (or right-click) a bundled item and
open it in a new window without resulting in collapsing the bundle.
Bug: T127416
Change-Id: Iaa06d5db8a1d5f9032874a800cafb6d5a4268876
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.
This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:
git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
parallel zopflipng -m -y {} {} \;
Files which zopflipng was not able to compress more efficiently were left unmodified.
Bug: T127608
Change-Id: I4bdef5e1b8e9ba63a3f13c7c475274e89f05ddc6
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.
This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:
git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
parallel zopflipng -m -y {} {} \;
Files which zopflipng was not able to compress more efficiently were left unmodified.
Bug: T127608
Change-Id: I1f01ac23c10d57edb8471f43ba01bf3cc8de5969
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
Make link-blue a bit bigger, revert a big smaller,
and change the blue used in link-blue.
Bug: T121624
Change-Id: I13d8667b4f2173c587330e1fc4604aa9f5632480
The rules setting the text color on the <a> with
various strong specificity overrides were unnecessary.
Instead, simply set the text color on -header.
This also makes the text color apply if there is no
primary link, because there is no <a> in that case.
Bug: T123756
Change-Id: I02c7d28438678968fa64a59beeac3d8d26cb0702
This will make the "flat" positioning of the bundle items a lot
more consistent and organized.
Bug: T121933
Bug: T123762
Change-Id: I472fcc89e540f1a886168069c547c6dc7e5ce613
Keep padding around the icon at 0.5em on the left and 1em
on the right for now; we'll change this soon to make the
icon centered.
Bug: T123656
Change-Id: I8c04daee460dd72e2358c3aa315110e05a9a5312
As a product decision it was decided that foreign notifications
cannot be 'mark all read' for their internal items.
Bug: T121930
Change-Id: I79292401b69adc4fad601192009296e02e8410b5
Make sure bundles can be marked as read by marking their sub-items
as read in the UI and also in the API.
However, for automatic 'mark as read' action (like the one that happens
when the model is "markReadWhenSeen") make sure to not mark-as-read
the bundles automatically.
Bug: T121930
Change-Id: I9d6bf6904fa3ca6559370e58853d29069f55af9e
The pure black icons which drew too much
attention when they are next to a lighter
text is changed by controlling the opacity
of the icons.
Bug: T119378
Change-Id: I2e6c8d47187621607a915e49cfe5380c744efe56
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
We already output unix timestamp both in user preference timezone as well as
utc, but we only had the user timezone version for TS_MW format.
While we could change the frontend to use the unix timestamp format, I don't see
any reason not to also include the MW format in utc. Frontend can now easily use
that.
Also fixed creation of the moment object. The timestamp was created as UTC, but
the way it got there was wrong: it expects the timezone offset (Z) to be
included in the timestamp, which is not the case (so it just ended up at +0:00,
which was fine, but confusing). I removed the 'Z' and forced it to be
interpreted as utc.
Bug: T121813
Change-Id: I09403615a1ffbde5dd69af9914afdbdd86cbfe4d
We removed the item first from the 'unread' counter and then told
the API to mark it as read. The API, however, wisely first checks
if there is anything *to* mark as read, but by that point, the
unread count is zero, so it gracefully refuses and returns an
empty resolved promise.
That is clearly not the way to go. Remove the read item from its
smart unread counter only **after** it was sent to the API to be
marked as read.
Note: We shouldn't wait for the API promise to resolve to remove
the item from the counter, but the API should run its preliminary
tests before the item is removed.
Bug: T122087
Change-Id: Ia5fc35c7435db8c4742238897da67681cee23c41
Do not send an update to 'seenTime' to remote wikis; only update
the items that are in the local API.
Bug: T121928
Change-Id: I291ecdb53364327dbdcb769c0d93512eeed3ab29
Have the group item expand itself not only when clicking the literal
'expand' button, but also when we click the entire item itself, as
if to open the notification item.
Renamed the expanding method so it is not specific for the button
event alone; also renamed the 'toggleExpand' to 'toggleExpanded',
as it toggles the inner 'expanded' state withot the API request
expansion process.
Bug: T121929
Change-Id: Iac23e06d1c17be4e1c5f63663fb0f81261f50070
Use #888 instead of #666 to match secondary link text
(which is #000 with 50% opacity), both in the flyout and
on the special page.
Bonus: use LESS variables for these colors.
Change-Id: Ifc1182a001e9b25f6ff7c213b6fcde3dc2f0acd2
* 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
Adds support in the logger code that is unused for now.
Note that I9bf6f4bcd41d8da5 must be deployed before this can be used on
Wikimedia sites.
Bug: T120158
Change-Id: I1968f36e21139975d25231ac25c22a73dea6fd0d
I'm not really sure where to stick the primary link. I could wrap the
entire notification in a <a> tag, but all the text becomes ugly (I
suppose we could hack around it with CSS?). For now I just added it
before all the secondary links.
Change-Id: I4f6add9ecfb367660d1a6346825382ad415bdb77