Commit graph

439 commits

Author SHA1 Message Date
Fomafix c43cdce48c Some small JavaScript/jQuery improvements
Change-Id: I33feb8bccbd870f589a01dc187e6155b7498714c
2024-04-08 19:45:22 +00:00
Fomafix effd4fe133 Use eslint rule "no-var": "error" and replace all var
Change-Id: I67acf88e1b8de55054248d7cf8ca622d5772ea6f
2024-03-29 07:40:22 +00:00
jenkins-bot 90470423ac Merge "Use alphabetic order for eslintrc rules" 2024-03-29 01:26:50 +00:00
Fomafix 05eb2ac47d Integrate service 'Minerva.Menu.MainDirector' into SkinMinerva
The service 'Minerva.Menu.MainDirector' is bad because it depends
on the global state.

Change-Id: I170653006356932ecdd909b14c193f42c4a5f511
2024-03-28 17:33:18 +00:00
Fomafix c50069252d Integrate service 'Minerva.Menu.UserMenuDirector' into SkinMinerva
The service 'Minerva.Menu.UserMenuDirector' is bad because it depends
on the global state.

Change-Id: Ife13188745b39844356e7976379582d5f451f5a3
2024-03-28 17:32:42 +00:00
Fomafix 86fb2a8d18 Inject service 'Minerva.SkinUserPageHelper'
Change-Id: I91d8066ea860bd4aa5f19f4c326fad032be5b9d0
2024-03-28 17:30:01 +00:00
Fomafix 0adbe80280 Use service 'Minerva.SkinUserPageHelper' in SkinOptions
Change-Id: I014e61c6692adbbe449f1e6aa9c6ae73dbcff925
2024-03-28 17:27:45 +00:00
Fomafix f8b8a83dc5 SkinUserPageHelper: Use alphabetical order of the parameters
Change-Id: I2bce7abfa2740ca7f3fb87968462cdc8eacbde7d
2024-03-28 15:20:36 +00:00
Fomafix 1c26798431 SkinUserPageHelper: Remove global state from constructor
* Move global state parameters to new methods setContext and setTitle.

This change solves the circular dependency error for service
'SkinUserPageHelper'. The service will used in SkinOptions in the
follow-up change I014e61c6692adbbe449f1e6aa9c6ae73dbcff925.

Change-Id: I80342e5168435c5318c378e2ac8a9a3c7a28eb4c
2024-03-28 13:10:48 +00:00
Fomafix dfa61af611 Use alphabetic order for eslintrc rules
Change-Id: Ic7afff052c004ba179a8814f79e7722fb66bdbbc
2024-03-27 19:54:21 +00:00
Fomafix 220bf6ff89 Inject service 'Minerva.LanguagesHelper' into SkinMinerva
Change-Id: Ie81195f31194bab819491576681b02660ec057b4
2024-03-25 22:36:07 +00:00
Fomafix f68b218076 LanguagesHelper: Move $out from contructor to doesTitleHasLanguagesOrVariants
Services MUST NOT vary their behaviour on global state, especially not
WebRequest, RequestContext (T218555).

Change-Id: I4b73ef713166d8b254023c1eebbb45c963880a99
2024-03-25 22:34:37 +00:00
Fomafix 57d1f15d64 Inject service 'Minerva.Permissions' into SkinMinerva
Change-Id: Ie68691d7030ea622f2bc232fea2df49b70484e19
2024-03-25 21:44:13 +00:00
Fomafix 999f04c366 Inject service 'Minerva.SkinOptions' into SkinMinerva
Change-Id: Ia7e7660c55e16731366bdf6332d5237188e9bbb1
2024-03-25 13:17:32 +00:00
Moh'd Khier Abualruz 5d6b866890 Rename the skin night mode classes to more readable classes
The classes:
- skin-night-mode-clientpref-0
- skin-night-mode-clientpref-1
- skin-night-mode-clientpref-2
is being replaced with
- skin-theme-clientpref-day
- skin-theme-clientpref-night
- skin-theme-clientpref-os
- Moved $forceNightMode to be a text parameter (dat|night|os)
- Keep adding the old classes to the html element, to give the ability of gradual deployment

The preference is renamed from minerva-night-mode to minerva-theme (a follow up to consider
migrating existing values will follow).

The query string minervanightmode continues to behave the same but now
accepts other values such as day, night and os.

Bug: T359983
Change-Id: Ia253de68f94236e7fe2219b736dd6084c64ce838
2024-03-19 23:12:59 +00:00
jenkins-bot 5b9fcf1260 Merge "Move Hooks::setMinervaSkinOptions to class SkinOptions" 2024-03-11 23:15:42 +00:00
jenkins-bot 6954616670 Merge "LanguagesHelperTest: Use @dataProvider to configure test cases" 2024-03-11 07:18:51 +00:00
Umherirrender 88b78b247c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I693651564cc544b881e1a45ea8abeff8d58d8fb6
2024-03-11 00:34:07 +01:00
Fomafix 52dd233f5e Move Hooks::setMinervaSkinOptions to class SkinOptions
This allows to inject the services.

Change-Id: If091c7c5df2d498cdb7d82db89876dab8a82c3fc
2024-03-09 22:34:28 +00:00
Fomafix 916ead077f Remove useless ->expects( $this->any() ) or use $this->once()
Change-Id: Icfb5a6294f86a108c66c872270de0f0205596b4d
2024-03-09 21:29:44 +00:00
jenkins-bot 201cad0f66 Merge "Inject service LanguageConverterFactory in LanguagesHelper" 2024-03-08 20:44:55 +00:00
Fomafix 5a5315b927 Fix typo in variable name
Change-Id: I5461ea73b15bb8064d02a5f87135dc13b0ec53d5
2024-03-05 20:58:06 +00:00
Fomafix 2f5b6f7c02 LanguagesHelperTest: Use @dataProvider to configure test cases
The two test cases can combined.

Change-Id: I7bff4993e87d8c7a95eb55d4e4596f9330105391
2024-03-05 18:37:35 +00:00
Fomafix 52583a336d Inject service LanguageConverterFactory in LanguagesHelper
Change-Id: I2fd1b4c3b25a94cca59d08216390652759859a62
2024-03-03 13:00:31 +00:00
Fomafix 751da83410 Remove wrong parameter $this->once()
This parameter was probably intended as parameter for getTitle(), but
it is in the wrong parentheses. And even on a repair of the parentheses
the tests still fail with:

> 1) MediaWiki\Minerva\LanguagesHelperTest::testReturnsWhenOutputDoesNotHaveLangLinks
> ILanguageConverter::hasVariants() was not expected to be called more than once.

Also remove the useless ->with( $languageMock ).

Change-Id: I35a0617de2fe7dd0b58060cc8273ef756051d04f
2024-03-03 12:57:25 +00:00
Fomafix 0e82eb5d40 LanguagesHelperTest: Remove unused parameter from method getTitle
The remaining
  ->expects( $this->any() )
is also removed, because it doesn't check anything.

Change-Id: I7651fa7f04fb314ff998cd9d68fd2a6099e4aadb
2024-03-02 21:50:12 +00:00
jenkins-bot a46ac64378 Merge "Inject services in SkinMinerva" 2024-03-01 19:24:58 +00:00
jenkins-bot 57441d798a Merge "MinervaPagePermissionsTest: Remove unused parameter in buildPermissionsObject" 2024-03-01 18:20:36 +00:00
Fomafix 4e6c1a87b3 Inject services in SkinMinerva
Change-Id: I17ae52ab9bb251a501d9de38f8a7051118f9622e
2024-02-29 21:34:15 +00:00
Jon Robson 18620a4499 Default to day mode
Bug: T358811
Change-Id: Iadf061b85e3cff4b2e1fc6bda6ff034b5f71b918
2024-02-29 13:30:40 -08:00
Fomafix 56bef8120f MinervaPagePermissionsTest: Remove unused parameter in buildPermissionsObject
Change-Id: Iaf0ec206a05b809edccb6e64ec3706a4c60faf84
2024-02-28 08:01:32 +00:00
Fomafix 3bb9611497 Replace global variable by config
Use $this->overrideConfigValues instead of $this->setMwGlobals in the
test.

Change-Id: I1ae238235476a001683ea81d2b65d209a2774549
2024-02-27 06:45:34 +00:00
jenkins-bot a59ddbb849 Merge "Inject service WatchlistManager into MinervaPagePermissions" 2024-02-27 03:54:53 +00:00
Fomafix 6e9dde3a8a Use $this->getServiceContainer() in tests
Use
	$this->getServiceContainer()
instead of
	MediaWikiServices::getInstance()
in tests.

Change-Id: Ib6a4279e414a99dea052344f5d036f53fbf54d43
2024-02-26 20:08:42 +00:00
Fomafix 248180ef03 Inject service WatchlistManager into MinervaPagePermissions
Change-Id: Id41c85c8e119efbf9814be25ba659f1da1151eb4
2024-02-26 07:53:03 +00:00
Jon Robson b079031b0a Send a toast notification if night mode is not available
Add a skin-night-mode-page-disabled class to the HTML element when
a page was disabled by the new MinervaNightModeOptions configuration
flag.

Bug: T356653
Change-Id: I7a6582ef8f66e78cc6f07da06bc4d2a3277cfcf0
2024-02-14 01:51:23 +00:00
jenkins-bot 8dbb6d0be6 Allow pages to not appear in night mode
- Add config to skin.json
- Add the function in SkinMinerva.php to check exclusion of pages and namespaces.

Bug: T355705
Change-Id: I0fa0eab3bfa57cc6864dbdd2d6aeaa5582767c3c
2024-02-08 21:28:14 +01:00
Steph Toyofuku 573ac59dc5 Query params can set night mode value
Whereas previously, the value of the query param would simply determine
whether or not night mode was enabled, we would like to be able to
control the actual night mode setting off of the query param

Now, it functions as an option to force the user into a particular
setting, be it automatic, night, or day.  If the query param is not set
(if night mode is enabled via config), we will default to the user
option as before

Bug: T355118
Change-Id: I38ed94bfc1b80d0a827c63c6dbdd92eb6f1bf531
2024-02-05 14:45:49 -08:00
Steph Toyofuku ef46f238a7 Set up user option for night mode
Add a new user option, `minerva-night-mode`, and configure it with a
default value of 2 (automatic based on OS).  Rework the code in
`getHtmlElementAttributes` to set the initial class value according to
the user option, which will be set and saved inside of MobileFrontend

Bug: T355118
Change-Id: I4b0d63a186f490ba10b7655b3af4dcb8b64bd400
2024-02-02 13:28:35 -08:00
Steph Toyofuku f614ce6687 Add feature flag for night mode
Adds a config flag, `MinervaNightMode`, and wires it up as a skin option
for enabling/disabling the night mode toggle (sold separately)

Additionally, allow this feature to be enabled via the
`minervanightmode` query param

For now, turning the flag on will result in the class
`skin-nightmode-clientpref-1` being added to the HTML element, but in a
later change this will be updated to switch values based on the
forthcoming client pref

Bug: T355118
Change-Id: I35848ab80ee75d324ceb35d17794e2d3e620cc19
2024-01-31 00:38:51 +00:00
Ed Sanders 8ef144f936 build: Update linters
Change-Id: I5aa3ab891890b52057a5fc855315e5b1b2203037
2024-01-24 22:02:12 +00:00
Umherirrender 1ad05f4a2e Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I1eec0823b7af97ea5031ff00b111e0c88b45a155
2024-01-06 16:31:38 +01:00
Steph Toyofuku a0837cd3f5 Add tests for getTabsData and dependencies
I recently put up a change and was informed by jenkins-bot that I had
decreased PHP test coverage :/

As I would like to be the type of person that only  increases  test
coverage, I wrote the corresponding tests for my change, as well as the
member functions it depends on.  From what I can tell, this is the
correct method of writing unit tests, but please do let me know if there
is anything I'm missing!

Change-Id: Id5c4f76ae058d2b0d487245c28b9ccecc2deef8e
2024-01-02 15:15:29 -08:00
Steph Toyofuku 5e35d585cf Fix alignment for nearby and settings items in menu, and correctly hide when JS is disabled
Removes a `display: inherit` that was causing issues with the alignment of these two items in the menu.  In addition, correctly sets display to none for jsonly-specified list items when client js is disabled and rename the class to make it more specific to the menu items

Note: this will have a visual impact as it is fixing what is currently a visual bug.  The jsonly hiding will also not work with cached content, but since it's currently broken we figured this was acceptable

Bug: T346670
Change-Id: I56d2c4fcba09d199a0fd6aad2f1621509bbfaba5
2023-12-14 21:58:39 +00:00
Moh'd Khier Abualruz 41a5ac75c5 Update modules to not use data URIs to reduce bundle size
- Add "useDataURI": false to following modules:
 -- skins.minerva.mainMenu.advanced.icons
 -- skins.minerva.personalMenu.icons
 -- Remove .mw-ui-icon-mf-next-invert old class kept for caching from edit.page.js

Bug: T346162
Change-Id: I362fdc9c68a7483c182e3540cba6501d9b12959d
2023-12-06 00:24:22 +00:00
jenkins-bot dc3ffae59d Merge "Disable another flakey test" 2023-11-27 20:27:15 +00:00
jenkins-bot ea6cf440cf Merge "Revert "Revert "Disable flakey test""" 2023-11-27 20:07:23 +00:00
Bartosz Dziewoński 8c6067584b Disable another flakey test
Bug: T348539
Change-Id: Icb79bbd404b445a1c42d52b060475250d155490a
2023-11-27 20:48:05 +01:00
Bartosz Dziewoński 7c645549a6 Revert "Revert "Disable flakey test""
This reverts commit 49e2acf2f4.

Bug: T334634
Change-Id: I672e2a6ad31b02118051a21246d808ea94f0a7e4
2023-11-27 19:45:00 +00:00
jenkins-bot 093f4ee01f Merge "Revert "Disable flakey test"" 2023-11-20 23:27:02 +00:00