Commit graph

87 commits

Author SHA1 Message Date
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
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 5a5315b927 Fix typo in variable name
Change-Id: I5461ea73b15bb8064d02a5f87135dc13b0ec53d5
2024-03-05 20:58:06 +00:00
jenkins-bot a46ac64378 Merge "Inject services in SkinMinerva" 2024-03-01 19:24:58 +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 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
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
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
bwang 269bd5bdaf Remove old :before icon selectors and update selectors to not use minerva and wikimedia prefixes
Bug: T344022
Change-Id: I573d7b36513cd0b74f62621cc246f719bcb94256
2023-09-06 13:53:22 -05:00
gerritbot fd2fe83a0c Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I236a14b07bd78141f82e86d7ea872d24b6cd88eb
2023-08-19 19:36:46 +02:00
jenkins-bot 0c69779b73 Merge "Echo uses Button template" 2023-08-08 17:44:22 +00:00
Jon Robson ded6430b47 Echo uses Button template
Changes
* Update FIXME in userMenu.less to merge selectors
* We replace minerva-user-notifications class with minerva-notifications
to short-circuit Echo's code so that it no longer replaces the Minerva
notification badge with its own.
* We update resources/skins.minerva.scripts/initMobile.js to introduce
our own wire up code - this is responsible for opening Echo overlay
and reseting the counter. The code in Echo will be removed in a follow
up (see <I2f923e509d24524a2375ffbe6b3ef336487574bb>)
* We update skinStyles/ext.echo.styles.badge.less with styles from Vector 2022
so that Minerva desktop remains consistent with desktop Vector 2022 experience.
* We clearly mark technical debt relating to the special mobile version.

Testing:
* Pixel.js has a group echo that covers all the different variants.
Make sure to update to latest main branch before running these.
* Desktop should behave the same for Minerva as Echo.
* On mobile only when a user has unseen notifications a red circle
is shown. Otherwise a bell icon is shown, never with number.
* On mobile a single button is visible that combines alert and count
numbers.
* With Echo disabled a bell shows that links to the user talk page

Visual changes:
* Previously the red circle became a transparent/gray circle on click. Now
it will always be red.
* Minor aligment changes to red circle and bell icon are expected as
the change prevents MobileFrontend/Echo updating the icon to use
Codex.

Bug: T342907
Change-Id: I55c18cf723a32f80b93a01dd0687e005162c4e93
2023-08-08 15:44:38 +00:00
Daimona Eaytoy b84487b6f4 Avoid DB access in non-database tests
Bug: T155147
Change-Id: I812e9695f3db0db7e8b0d1001478adc90d35652b
2023-08-01 20:04:24 +02:00
Daimona Eaytoy 731c0b5703 Avoid accessing the database in SkinUserPageHelperTest
TestUser's are created for real in the test database, but this test
doesn't need that, especially because it's not in the Database group.

Change-Id: I8261b7e8130f0698df4f1684da767f312504c307
2023-07-17 18:11:32 +00:00
Umherirrender 32c1ebd3cc tests: Make PHPUnit data provider static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: Ie3edbdce0d5eae5b09236675469f32719cee558d
2023-05-20 10:58:18 +02:00
Umherirrender b21e4a98bc Avoid use of deprecated User::idFromName
Use a UserFactory instead of getting an id and the user objects on
second request

Also replace another deprecated User class and use the injected factory

Bug: T325687
Change-Id: Id610ee39e0ef865b97f7ae8506188eea04a86ac5
2022-12-21 22:35:49 +01:00
EllenR b94ce6adbd Normalise PHP namespaces used in MinervaNeue
removed commented out code
changed namespace Tests\MediaWiki\Minerva to namespace
MediaWiki\Minerva

Bug: T303104
Change-Id: Ie151dcbfc65b49cb91fea81f8526287ca18d7a7d
2022-05-05 07:07:45 -06:00
Umherirrender 4831549b14 Replace Title::newFromText by Title::makeTitle
* Prefer Title::makeTitle in unit tests where the title is known,
  this avoids title parsing and can improve the test performance.
* Use Title::makeTitle for the user page like done in User::getUserPage

Change-Id: I3901a6ed208a5ff90b216d01d3c4962cdcb48db1
2022-03-10 22:42:56 +01:00
jenkins-bot 1a2960a3c0 Merge "Tests: expected value goes first in PHPUnit assertions" 2022-03-10 20:55:17 +00:00
DannyS712 3da8d0c734 Tests: expected value goes first in PHPUnit assertions
Change-Id: I5dee074f69a48a6aca218855859a518ca1c051e1
2022-03-04 19:11:34 +00:00
Reedy b6685f9c4a Namespace SkinMinerva
Change-Id: I8f6bddac9f8cd060c551651e711ee987b8bbfbe3
2022-03-04 17:50:20 +00:00
Thiemo Kreuz bb31754073 Use PHPUnit shortcuts where possible
This makes the tests a little easier to read, I would argue.
any() is the default anyway. It doesn't add new information to the
test.

Change-Id: If4655ddea494f1054538a760802b583e17c0108e
2021-12-17 11:29:48 +01:00
Umherirrender 993332734a build: Updating mediawiki/mediawiki-codesniffer to 38.0.0
Change-Id: I35e6bd738c78db48d98e1a870de4a28654d3d3f4
2021-11-13 18:58:14 +01:00
Alexander Vorwerk 702ec511dc MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: I5b83516ccdf0ac025421844c9516e856060aefba
2021-10-12 00:53:10 +02:00
Jdlrobson 8651df02bb Replace categories button with HTML rendering
Bug: T246049
Change-Id: Id8c7493a525844b43c1628a1f4f09ae716ece2ba
2021-05-14 20:34:59 +00:00
vladshapik 6da72c8099 Avoid using User::isIP
Remove using of User::isIP since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T275602
Change-Id: I01a0c2ef4d750cf0e81a9345ee462787d4ee28da
2021-03-02 14:29:58 +02:00
Umherirrender 09b331ab83 Improve function and property documentation
Change-Id: I16cc3831cd4c917aa679c7f7c535b97e498291a7
2021-01-16 14:35:10 +01:00
jdlrobson c3b93e14b0 Simplify footer and logo generation
The data already provided by SkinMustache makes the existing
Minerva code redundant.

* html-after-content functionality equivalent to dataAfterContent value
* Rename license and last modified to have html-minerva prefixes and promote
to top level data object. This allows us to distingusih Minerva values from core
values.

Note: previously the logo used srcset to ship a 1x logo but these
were dropped during the desktop improvements work.

Bug: T256083
Change-Id: I7b2cd5181eae67b345f6686e3389a76a12e3b1a1
2020-10-16 23:41:34 +00:00
Jdlrobson 74838b2fa2 Revert "ServiceWiring: Avoid usage of deprecated Title::getSubjectPage()"
This reverts commit ae8e3ad58b.

Reason for revert: This led to T260155 as the internal class uses
isSubPage which is not available on LinkTarget

Bug: T260155
Change-Id: I783f41e70cf1cf3b91737bce9cbf9ac729a778df
2020-08-11 15:50:44 +00:00
Derick A ae8e3ad58b ServiceWiring: Avoid usage of deprecated Title::getSubjectPage()
SkinUserPageHelper::__construct() should be able to consume a LinkTarget
too as NamespaceInfo::getSubjectPage() method returns a LinkTarget and
the Title::getSubjectPage() is deprecated.

Change-Id: I08bfc9bb21772b450798b6354bee2ab09d5dba4d
2020-08-08 14:07:48 +01:00
jdlrobson 2e450e104e Donate link should be in a separate group in main menu
Bug: T219793
Change-Id: I7501c87eaa799e4c8a9052f5e3f650a89f376d1b
2020-06-29 14:38:34 -07:00
Reedy 2d7150125c Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I35b646522df6f0ec14ca8fee718937cc8cf44ce9
2020-05-19 22:59:27 +00:00
Reedy 01f824f684 Fix namespace of SkinUserPageHelper
Allows autoloading of file

Change-Id: Ife276b5802e3cdcfd5789a7a91684317c81d5bb3
2020-05-01 02:29:54 +01:00
Daimona Eaytoy edaa6715a0 tests: Avoid calls to Title::__construct
Change-Id: Ib41a016c1deb70daf4ccc302631d70ca7e006503
2020-03-13 14:01:04 +00:00
James D. Forrester 0892d190b6 Drop support for $wgMinervaCustomLogos being set
Bug: T232140
Change-Id: I56dc8ac8d394ad7561ea09e67da6c51db2bc90f9
2020-03-10 20:40:32 +00:00
jdlrobson 51a348097d Deprecate wgMinervaCustomLogos in favor of $wgLogos
Testing:
```
// Start with no Minerva config and no wgLogos defined in LocalSettings.php

// Set $wgMinervaCustomLogos
// Should trigger deprecation warning.
$wgMinervaCustomLogos = [
	'copyright' => 'https://en.m.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-fr.svg',
	'copyright-height' => 40,
	'copyright-width' => 120,
];

// Set wgLogos without wordmark
// Should trigger deprecation warning as $wgMinervaCustomLogos is still
// defined.
$wgLogos = [
	'1x' => 'https://en.wikipedia.beta.wmflabs.org/static/images/project-logos/enwiki.png'
];


// Set wgLogos['wordmark']
// No deprecation warning. $wgMinervaCustomLogos will now be ignored
// in favor of the new wordmark key.
$wgLogos = [
	'1x' => 'https://en.wikipedia.beta.wmflabs.org/static/images/project-logos/enwiki.png',
	'wordmark' => [
		'src' => 'https://en.m.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-fr.svg',
		'height' => 40,
		'width' => 120,
	],
];

// You can now safely drop $wgMinervaCustomLogos.

```
Depends-On: I66a971631c623cc94b58eb0e5e5bad804789bf1c
Bug: T232140
Change-Id: I013bd0904fe8c55efa49d14e84cf06ec1412896f
2020-02-19 23:59:28 +00:00
Umherirrender 5b0a4f30b2 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Change-Id: I529c6a67eeb5eb012031b69ef63f4338f3685178
2020-01-26 20:26:31 +01:00
Ammar Abdulhamid 898b048d1c Discontinue back-to-top feature
Bug: T237290
Change-Id: I06a6823bd3d1985a1d76384bb65c9d2ddf334a21
2019-12-11 05:12:43 +00:00
jdlrobson c0d5889da8 Remove unused test class
Not needed since I09c27a084100b223662f84de6cbe01bebe1fe774

Bug: T221007
Change-Id: I909acac40a3fc732b10d0e66f8d430a0148734cf
2019-10-22 19:16:36 +00:00
James D. Forrester e8d227b78e build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: I8ce5f16f496f048f6bcf587c545745193dbfe151
2019-10-11 12:04:00 -07:00
jdlrobson ab61dbb173 Echo is removed from Minerva
Managing the transition from old implementation to new:
* A version number is exported from skins.minerva.scripts to
tell dormant code added to Echo in I09c27a084100b223662f84de6cbe01bebe1fe774
to begin running.
* A skinStyle is added for the new `ext.echo.mobile` module.
`mobile.notifications.overlay` will soon cease to exist but is kept registered for
backwards compatibility reasons
- Drop ev.preventDefault call from onSkinClick - it is no longer necessary and will ensure
notifications overlay closes when shield is clicked while it is open.

Integration:
* A server side hook SkinMinervaReplaceNotificationsBadge allows Echo to replace
the current Minerva notification badge
* A to-be-created client side hook is subscribed to to deal with the navigations drawer
like functionality using the mainMenu code
* id and class names are added to the container for the NotificationBadge for compatibility with
ext.echo.init in Minerva's desktop mode (it will work like Vector)

See I09c27a084100b223662f84de6cbe01bebe1fe774 for understanding the bigger
picture.

Depends-On:  I09c27a084100b223662f84de6cbe01bebe1fe774
Bug: T221007
Change-Id: I4c11f1b241d629e1b294ebaec17472fbf944f8c7
2019-10-08 23:21:12 +00:00