Adds support for the night-mode theme in Minerva by
adding the `.skin-invert` class to the mobile overlay content.
Bug: T356425
Change-Id: I5ccb486d7af798a9e3da83c28246dafb49b72443
This code has been moved to Minerva and is no longer serving any
purpose. The handlers are replaced with an already standardized
mw.hook for Minerva to subscribe and respond to.
Bug: T342907
Depends-On: I55c18cf723a32f80b93a01dd0687e005162c4e93
Change-Id: I2f923e509d24524a2375ffbe6b3ef336487574bb
This will essentially all be deleted after I55c18cf723a32f80b93a01dd0687e005162c4e93, but thats fine\
Bug: T343053
Change-Id: Ifb382af388cdc24dc1ecef105ec89c9129194c19
Pass a relevant number of unread notifications to the messages
'echo-mark-all-as-read' and 'echo-mark-wiki-as-read' each time
they are used, in order to facilitate the use of PLURAL in
the messages. This allows translators to say e.g. "mark both as
read" when there are two unread notifications, for instance.
Bug: T321462
Change-Id: Ida65be2d7f2663d9802f71c7ea1eb588db8cd254
Replacing 'mediawiki.ui/variables.less' `@import`
with new skin-aware 'mediawiki.skin.variables.less' standard.
Also replacing and removing scattered WikimediaUI Base v0.15.0 variables
with new skin variables.
Also
- replacing several static values with new Codex design tokens featuring
skin variables for following properties:
- background-color
- color
- border-width, border-style, border-color and border shorthand
- border-radius
- box-shadow colors
- outline-width, outline-style, outline-color and outline shorthand
- opacity
- replacing equal-value Echo variables with new skin variables
- replacing `opacity: 0` with `opacity: 1px solid transparent`, which
improves accessibility in Windows High Contrast mode
Bump required MediaWiki core version to >= v1.41.0.
Bug: T332541
Co-Authored-by: Volker E. <volker.e@wikimedia.org>
Depends-On: I04f9e48a1cf9dee915cf51e1e12b17ff0a595a06
Change-Id: If3863f07d7c3a8b58808fb03401c1060a92bc2ab
When Echo moved to packageFiles it broke the mobile
unread counter behaviour
Follow up to I03f9a3953aa97ead1a29c13a992a02404a6d0b68
which presumably happened when Minerva's Echo code was
in a different code repository.
Bug: T310358
Change-Id: Ife6705d69d248bcd4efde1a996dbcc0353c7f40d
== Problem 1 ==
As of I09c27a084100b223, tests/qunit/index.js or equiv was used to
load test files asynchronously from a using() callback. This was
untracked by RL or QUnit, and thus sometimes ended up finishing after
the test runner was already done executing all tests. In CI this
means the tests are sometimes never loaded and the browser (or Node)
process already killed before they even have a chance to arrive.
Prior to QUnit 2.17, this was no way of detecting this. As of
QUnit 2.17 (core upgraded last week) when running tests manually
the following helpful warnings appear in the console:
> [warning] Unexpected test after runEnd.
> [warning] This is unstable and will fail in QUnit 3.0.
> test @ qunit.js
> tests/qunit/model/test_mw.echo.dm.SeenTimeModel.js
> require
There were about 1072 instances of this warning, all from Echo.
Fix this problem by removing the async callbacks and specifying the
two modules as normal dependencies instead.
== Problem 2 ==
Class NotificationBadge was being loaded in a strange way out of
bound. This was a violation of module boundaries and should not be
needed other than for a temporary hack or other tech debt. More
generally when a test uses `packageFiles` this is a likely sign of
tech debt or misunderstandings.
Instead, depend on `ext.echo.mobile` and export/import the class
as normal.
After this, the test module can use `scripts` instead.
== Problem 3 ==
The `ext.echo.mobile` uses a Mustache template which the test
was also duplicating a reference to. This is no longer needed now.
Due to the `qunit/index.js` file carefully splitting the operations
between template assignment and file loading, I wondered whether
it was meaning to replace or mock it with something else, but it
simply refers to the same file and only does this because it wasn't
using the module directly. This is now resolved.
If you do need to mock in the future, this can simply be done
by assigning `NotificationBadge.prototype.template` from a
beforeEach() callback in the test suite, or by supporting it
property as a constructor option in NotificationBadge.js and
assigning `this.template` there, which is supported by the
mobile `View` class already it seems and would follow DI patterns
more effectively.
== Problem 4 ==
Most of the Echo tests were ignored sometimes and executed other
times.
The test for `ext.echo.mobile` in particular though was never
executed in CI specifically because:
> Undefined module: 'mobile.startup'
This became a hard error with this patch, which is fixed by
the CI config change with Ie9dabe3269c56fa76db8e51.
Bug: T299780
Change-Id: Ie4a87f3b8085fd6ae53ec586c1782cc266d5288a
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
Calling overlay.hide() doesn't invoke the onBeforeExit handler
(anymore? not sure if it ever did), so we have to call this handler
ourselves when manually closing the overlay.
Bug: T258954
Change-Id: Ife5926241c0b8473607c14df0f89c794728566dd
This is a factory function. self.hide is replaced with overlay.hide
and a local variable to correct.
Bug: T255630
Bug: T253045
Change-Id: I3dae26e798b0c2e7520c2f01b017c257cc81e995
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