Commit graph

81 commits

Author SHA1 Message Date
jenkins-bot 586e1291bf Merge "Clicking Echo badge should close ULS dialog" 2022-03-05 06:09:41 +00:00
Jon Robson 0c074ec91a Clicking Echo badge should close ULS dialog
Bug: T295796
Change-Id: I3a7f33cad4e08ce22b6e640901c965d764c9156b
2022-03-04 22:47:23 +00:00
Timo Tijhof 1ae60e5977 ext.echo.mobile: Name init function as such for clarity
It is common for internal files to export a single value, e.g.
when a file exports a single class or other special value.

However, this is uncommon for a module's overall export.

* It can create the misunderstanding that the init code is immediately
  executed, when it is in fact delayed.

* This leads to the obscure `require()()` statement that is easy to
  misunderstand.

* The least-effort way to expand this is by adding a statement
  like `module.exports.Foo = Foo` after `module.exports = init`
  which has the sublte behaviour that 1) it only works in this
  order, not reversed as then Foo would be de-referenced by the
  second assignment, and 2) it has the subtle effect of attaching
  Foo to the `init` function as `init.Foo` which is non-obvious,
  and 3) makes the init function unsafe to pass around, wrap,
  stub or otherwise treat as a regular function.

Remedy by naming it as "init" on a regular module export object.

Change-Id: I51065e00f9dcaec075578a46df4de32c7a427df3
2022-03-01 23:11:40 +00:00
Nicholas Ray 2583f803c3 Add talk notification instead of transforming the talk link
Note: This change would potentially affect all skins including modern
and legacy Vector and others.

The status quo when a talk notification is present is to transform the
talk link into an orange notification message. One option is to leave
the talk link and **add** a notification instead of transforming it.

This will result in two elements #pt-mytalk and #pt-talk-alert
This will interfere with styles targeting #pt-mytalk .mw-echo-alert
This impacts user styles but not anything in production.

Bug: T283811
Change-Id: I3e4be1381f9a2e9986b94b3b13df5ed64d09a59d
2021-06-04 09:33:50 -07:00
Nicholas Ray 3a351cfb4f Move talk page notification data from 'user-menu' to 'notifications'
**Note**: This change will affect the order of the yellow talk page
message notification on legacy Vector/other skins by moving it from
after the `#pt-notifications-notice` element to before the
`#pt-notifications-alert` element. This was done because the
notification is related to the list of messages that appear when the
bell icon is clicked so having it in close proximity to that icon is
hopefully more intuitive than having it next to the unrelated inbox
icon. [1]

Per T274428, we need this notification to be inside the `notifications`
array instead of inside the `user-menu` array.

Additionally:

* Per T274428, update the notifications message copy to "You have a new
Talk page message"

* Remove the `onPersonalUrls` hook method inside EchoHooks,
unregister its use as a hook in extension.json, and update its
references in Echo.

[1] T274428#7113896

Bug: T274428
Change-Id: I5ae0ec089bcf0eec1ec7ac13f60e811f54e1d8e1
2021-05-25 18:24:29 -06:00
libraryupgrader cefce8b8fa build: Updating eslint-config-wikimedia to 0.20.0
Change-Id: If1eaa61aefc93426217f675fca27873dd9db6dc1
2021-04-16 14:24:33 +00:00
Ed Sanders bb1bd02bd6 eslint: Fix warnings
* Load wikimedia/jsduck rules
* Add inline disables for compat
* Fix shadowed variables

Change-Id: I42234ab74f5007c16ff3960309335e715da76c1c
2021-02-01 21:02:46 +00:00
jdlrobson 31401f9b00 Catch malformed URIs
It is documented that Uri can throw an exception so this should guard
against this case.

Bug: T261799
Change-Id: Ia45654194f853923a5b05ceff3ab2b47f6dd87d8
2020-10-20 19:42:20 +00:00
Roan Kattouw 0ff7678377 Document ext.echo.unseen counters
There are two counters (ext.echo.unseen and ext.echo.unseen.click) that
are incremented in two different places. It's hard to see how they're
connected unless you know where to look.

Add comments to each of these counters pointing to the other one and
explaining what they're for.

Change-Id: I0699cba85bf797e4f7ef42cc6a7a996aa35510f0
2020-01-16 17:46:08 -08:00
jenkins-bot 1f96009221 Merge "Use document.body instead of 'body' as jQuery selector" 2020-01-05 23:33:24 +00:00
Fomafix 99dc512ef8 Use document.body instead of 'body' as jQuery selector
Also use the shorter .appendTo() instead of .append().

Change-Id: I1e0aaff4790a6ca5c9e5d2f6e5926e15f8574cee
2019-12-16 11:51:03 +01:00
Ed Sanders 80ddee3956 build: Update linters
Change-Id: I713aafb891306fc21a776a7d4622c6a039798753
2019-12-12 11:20:49 +00:00
Zoranzoki21 5a05e94a1e Remove comment related to skins.minerva.scripts after removal of it in 1053997
Bug: T221007
Change-Id: I0ca3e195aa623cff7ef437dc177179dee13c7cd1
2019-10-16 10:30:57 +00:00
jdlrobson 10539971f1 No longer check for skins.minerva.scripts
Echo is now in complete control. Cleanup after ourselves.

Change-Id: I9a26c7a88f5e3ff19ec5b17b08a0d05c4f9e60ce
Depends-On: I9a6b06158d9083317aea46510c0c47980a25e50a
Bug: T221007
2019-10-16 09:27:24 +00:00
jdlrobson d3c0494a17 Dormant mobile notifications overlay lives in Echo
This code will be enabled when Iba1d7863171268066bf7597182c57a0a2041497f
relinquishes the responsibility for rendering the Echo notification badge
and wiring up of the related JS.

It makes 3 assumptions:
1) Minerva will expose a VERSION property on the skins.minerva.scripts module
to tell Echo it can begin control of the functionality
2) A new hook `SkinMinervaReplaceNotificationsBadge` will run on the server side
allowing Echo extension to render the Notifications badge in Minerva.
3) A new client side hook (echo.mobile) will fire whenever the Echo dialog is opened or
closed.

All code relating to Echo inside MobileFrontend and Minerva is
moved here.
CSS for the modules is kept in Minerva as skinStyles

This code remains dormant until Iba1d7863171268066bf7597182c57a0a2041497f lands.
It pre-registers a "to-be-created" hook SkinMinervaReplaceNotificationsBadge that
substitutes the Minerva badge.

It also watches the export value of skins.minerva.scripts for a VERSION value - when
this appears it will take the signal that it should manage the frontend code.

In the new system the mobile specific code is limited to the mobile version of
Minerva. The desktop version of Echo loads on Minerva desktop - presenting an
opportunity in future to consolidate both implementations to use the same component.
The mobile version of Vector and Timeless for example will load the mobile overlay
(with existing styling issues that we don't need to worry about right now given
we don't officially support skins other than Minerva as mobile)

Testers:
* Check require( 'ext.echo.mobile' )(); inside initMobile
inside ext.echo.init does not fire until
Iba1d7863171268066bf7597182c57a0a2041497f is checked out.

Depends-On:  I1a66939d2b596094b419de40b370e79f09c85581
Bug: T221007
Change-Id: I09c27a084100b223662f84de6cbe01bebe1fe774
2019-10-09 12:36:11 -07:00
jenkins-bot 30dbae4c02 Merge "Render HTML in notification snippet" 2019-08-21 08:11:28 +00:00
shivanshbindal9 2406462c01 Render HTML in notification snippet
The HTML tags are not parsed in notification snippet.

Bug: T226130
Change-Id: I94cd63d351ac034d80b58a934a823aa0efe18cf5
2019-08-20 23:54:15 +05:30
Kosta Harlan 2a4fde702a Use utility functions to improve code readability
Change-Id: Idf39028d41293b33153254f7648babc3a0cb2b82
Follows-Up: I8cdeb9ee920d3ec943e270eb00a6ef7f3a7449e2
Bug: T226127
2019-08-16 22:25:51 +02:00
shivanshbindal9 8821563955 Add unseen class to alert/message icons
When there are some new notifications during polling,
the unseen state of alert/message icons does not change.

Bug: T226127
Change-Id: I8cdeb9ee920d3ec943e270eb00a6ef7f3a7449e2
2019-08-16 20:32:11 +05:30
shivanshbindal9 2528e3394f Define preference for poll updates
New preference added so that user can set
* Displaying (n) total unread count in the title
* Displaying notification snippet for incoming notification

Bug: T229732
Change-Id: I35eb68dedf1e087b4668bfec404935f1244b3d0b
2019-08-06 19:42:49 +05:30
Roan Kattouw 092615db27 ext.echo.init: Un-dim badge if loading RL modules failed
We didn't have any error handling for this scenario previously, but the
recent refactor of this code made it more obvious that it was missing.

Change-Id: I146de3ed2cde1a9bd553fc4825c0e4e06130de65
2019-07-31 22:55:25 +00:00
shivanshbindal9 6be1eee1db Display notification text for incoming notification
As now polling is used to update the notification count on header icons.
If there are any new notifications then a snippet containing the header
part of the notification will appear using mw.notify().

Bug: T226130
Change-Id: Id38c8ebedebd4c68b9cef0635043d6f9304784dd
2019-07-31 17:54:20 +05:30
Roan Kattouw d378e4e3b9 Use packageFiles instead of startup module for config vars
Remove wgEchoMaxNotificationCount and wgEchoPollForUpdates from the
startup module and put them in the ext.echo.init module.

Change-Id: I03f9a3953aa97ead1a29c13a992a02404a6d0b68
2019-07-18 15:29:27 -07:00
shivanshbindal9 795b87d55b Change polling rate when document not visible
We currently poll for the count of notifications after some fixed amount of time even when the user is not using it.
There is no need to poll at same rate in that case and we can poll at slower rate.
The rate now is decreased by 5 times.

Bug: T227501
Change-Id: Id53a88e0d5659edb0dac77dd3e346e2d88e95f94
2019-07-13 17:11:08 +05:30
shivanshbindal9 1a035e1287 Add visual cue to indicate change in notification count
* Adds notification count(alert+messages) to the title
* The count is updated immediately when notification count changes
* This functionality is feature flagged(wgEchoPollForUpdates)

Bug: T225259
Change-Id: Ic92c50d9885b0e4325b253338023d37adf8d35d0
2019-07-01 14:31:36 -07:00
shivanshbindal9 43bff91c68 Make Notification count update without page reload
* MVC is used to change the count of notifications on header icons.
* The Widgets are loaded after 60secs or icon click, whichever occurs first.

Bug: T219222
Change-Id: I2d034a76d5c3abe55894dd1dd10e28713344c5bb
2019-06-18 04:49:59 +05:30
James D. Forrester 38b41c0f98 build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I6747b5e36f64d681b6f83461f0ebb9c9f88bea86
2019-04-03 15:57:20 -07:00
Ed Sanders 7ed027ddcf build: Update eslint-config-wikimedia to 0.10.1
Change-Id: I776585adab962c2b1d353d18d3a02b6662941b13
2019-02-06 01:42:53 +00:00
Ed Sanders 17126b2ab1 Remove obsolete aliases from closures
Bug: T208951
Change-Id: If51fc6d50b9755c779fd0bf1be7bb0fe276539ea
2018-11-12 13:56:38 +00:00
Roan Kattouw 7a816f8d26 Make markasread parameter work cross-wiki
Add a markasreadwiki parameter, and use cross-wiki API proxying to mark
the specified notification(s) as read on the originating wiki.

This allows notifications to be marked as read when the primary link is
followed, even if the primary link points to a different wiki.

Bug: T179765
Change-Id: Id7e1e11997173e1578e33cd189dc0f93a5e4ba63
2018-09-03 10:59:31 -07:00
Ed Sanders e204977063 Make 'links' a required argument of NotificationBadgeWidget
Change-Id: Ib1ae2cf1edc1d0a280eb62558d93d081f365ca84
2018-05-22 15:42:45 +01:00
Moriel Schottlender b2f2ef9114 Prevent double-clicking on badge when initializing
Double-clicking would just recreate the badge midway while it is
being created, and produce 2 popups simultaneously. This patch
ignores the second click in a double-click until the widget is
being replaced anyways.

Bug: T184883
Change-Id: I2fda8df36b3828dbbe0d9b7892f159e598c630bd
2018-02-23 14:36:39 -08:00
petarpetkovic cde5b2d1e9 Add fallback to getting Preferences and Notifications URLs
Change-Id: I0ab756cafcbd535fa1765fd12fdd72bb75f0df62
2017-12-13 23:12:07 +01:00
Moriel Schottlender 57f14931b6 Consistently use the message when updating count
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
2017-09-14 17:33:48 -07:00
Stephane Bisson fcbc0ea2bc Remove calls to debouncedUpdateThemeClasses
debouncedUpdateThemeClasses doesn't seem to exist
anymore in ooui.

I'm not sure what this function call was for.
My limited testing has reveal no obvious
problems after removing it.

Bug: T155800
Change-Id: If9ab35ed57e51b103cc5474ea902da390abaf69d
2017-01-20 10:48:32 -05:00
Fomafix a76bd5320f Replace $( document ).ready(...) by $(...)
In jQuery 3 $(document).ready(...) is deprecated.
https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function

Change-Id: Iff3d7fb07a739fc6ff9b62a2f586c54cd9c8f315
2017-01-06 14:06:39 +01:00
Ed Sanders c8d24ebd17 build: Replace jscs/jshint with eslint
Change-Id: Iee1d1b20ed31e636bfb8fc8cf9b18ff328bf608c
2016-11-23 15:25:59 -08:00
jenkins-bot 181c0b9557 Merge "Enable local bundles on mobile" 2016-08-05 22:00:35 +00:00
Roan Kattouw 16d239c516 Remove allTalkRead listener for the messages popup
This fixes a bug where changing the read status of any notification
in the messages popup would remove the "You have new messages"
banner even though there are still unread talk page notifications
in the alerts popup.

Change-Id: Ic6b3d2c9fa764be2da8f9bd9b0d10311857f8509
2016-08-04 13:58:47 -07:00
Stephane Bisson 3600a271c5 Enable local bundles on mobile
Have the 'bundle' param always
controlled by the controller
instead of configured in the
API.

Change-Id: I08fb7c515f1af28fc01073702b552624cc14f2f0
2016-08-04 10:42:11 -04: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
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
jenkins-bot 6fa22b5d49 Merge "Check for local unread talk notifications in alert popup too" 2016-07-22 01:54:32 +00:00
Moriel Schottlender 0431dbf235 Check for local unread talk notifications in alert popup too
Alert popup can now also have talk-page related notifications, so
we should make sure we listen to 'allTalkRead' event when it is
updating as well.

Bug: T141047
Change-Id: I1317efc63b503bd1a55734ebe377ff4c617fe485
2016-07-21 16:18:51 -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
Stephane Bisson f8a8d392d6 Expandable bundle
Support bundles being expandable
to show their sub-notifications.

Bug: T114356
Change-Id: I1507cae360f45cc87f2d60e966b4d047abfa202d
2016-06-28 15:37:54 -04:00
Roan Kattouw 2872b5eae2 Remove automatic mark-as-read-when-seen
Bug: T132525
Change-Id: I095704252eaf2f8fe71950a4cfcd42a6fce431ff
2016-06-17 17:09:25 +01:00
Stephane Bisson 26bc47c1b2 Don't mark alerts as read when seen
This is done the quick way by just turning
off a config option. The full cleanup
is in I095704252eaf2f8fe71950a4cfcd42a6fce431ff

Bug: T132525
Change-Id: I5becaa2f91b7eff6ebe4ce3943e86975c844c884
2016-06-14 08:50:47 -04:00
Moriel Schottlender 8e76bc4126 Refactoring Echo's front end for MVC
Changing the way Echo's front-end architecture works to work with
model-view-controller methodology.

Change-Id: I97862402c41bc04dd41cd08d79f19ff677340249
2016-05-18 12:28:45 -07:00
Roan Kattouw 7942a2de79 Replace mark-as-read-on-click with ?markasread= URL parameter
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
2016-05-03 00:20:03 -07:00