Commit graph

451 commits

Author SHA1 Message Date
Umherirrender 77fe39e565 tests: Use renamed class BundleSizeTestBase
Follow-Up: I131e0d85bd14e75aaebd6f212b2e64a45d4c73a2
Change-Id: I964bd25209fa07406e57a7571c2a06b572f590c4
2024-06-12 20:37:51 +02:00
Fomafix 4e4caef154 Migrate service 'Minerva.Menu.PageActionsDirector' into new class PageActions
The service 'Minerva.Menu.PageActionsDirector' is bad because it depends
on the global state.

Create a new service 'Minerva.Menu.PageActions' and inject this.

Change-Id: Ie84d02ef29d3b7809f490a1593cb2f3cef60b3a3
2024-06-04 20:10:41 +00:00
jenkins-bot 4eb77c4801 Merge "SkinUserPageHelper: Reset fetchedData on setTile" 2024-06-04 20:07:26 +00:00
Fomafix ad1fa7fbb7 SkinUserPageHelper: Reset fetchedData on setTile
This change restores the special toolbar behavior on user talk pages
lost in I80342e5168435c5318c378e2ac8a9a3c7a28eb4c.

Also add a test case that checks the cache on multiple setTitle calls.

Bug: T366645
Change-Id: Ifb481c546f2f77bd502cd9390d371a6e82bd5e69
2024-06-04 19:42:35 +00:00
Ed Sanders a6ab8d6da3 Prefer arrow callbacks (ESLint autofix)
Change-Id: I52b2feacd6216e99e04f193ba963e897b3e1a771
2024-06-04 08:01:54 -07:00
Ed Sanders 5732926921 ESLint: Enforce no-underscore-dangle
The rule is only broken once in reference to a MF class,
so just switch those to inline disables.

Change-Id: I96ebd7f034246da13788b8c8673bff203c18b2db
2024-06-03 12:59:48 +01:00
Ed Sanders a5c9a506c9 ESLint: Remove unnecessary config no-var:error
This is the upstream default.

Change-Id: I09797b9e9243707f0b2a7942d34d27b1271d9eb4
2024-06-03 12:56:30 +01:00
Fomafix 342beaeb18 Update namespace of PHP classes
Change-Id: Ia8a8d643a8e96372ecc7e481c0e3d50a31ccd4e8
2024-05-21 15:08:47 +00:00
Fomafix 7f4c7d2db2 Add eslint-disable-next-line security/detect-non-literal-regexp
Change-Id: Ie85cdab8d2407fd432ae420ae46970490c2f693d
2024-05-14 12:41:50 +00:00
jenkins-bot 88d092021d Merge "Selenium: Drop dead code" 2024-05-10 13:57:31 +00:00
Fomafix e85265ada5 Improve PHP class references
* Declare class names from other namespaces in the `use` block.
* Use Foo::class instead of 'Foo' to reference a class name.

Change-Id: I5a1aba6b0cc8842d71b6b6df0a0b67e16e5b6453
2024-05-07 18:30:43 +00:00
Jon Robson 14ca9d0ad9 Selenium: Drop dead code
All these tests and associated steps are skipped and apply to pages that
no longer exist - Special:MobileDiff and Special:MobileHistory and can
safely be removed.

Change-Id: I15edf8c2fc88fbc01585c2b7e1243daa6d9210b9
2024-04-26 10:15:10 -07:00
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