Commit graph

119 commits

Author SHA1 Message Date
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
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
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
Jon Robson d342cb32ef [Icons] Use Button template in PageActionsMenu.
Use the Button.mustache partial in the
PageActionsMenu.mustache template.

This converts the page actions menu to use the Button
template in a way that doesn't change the existing HTML.
The mw-ui-icon-element and mw-ui-icon-with-label-desktop
classes are placed onto the Button.mustache markup.

Bug: T342908
Change-Id: Ib5dadd929eea2e72a24e061c4174348615890617
2023-08-10 19:27:44 +00: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
Jan Drewniak 3020e58eaa [Icons] Use IconLegacy template in menuGroup and ToggleListItem
Updates the menuGroup.mustache and ToggleListItem.mustache
templates to include the IconLegacy.mustache template partial.

These templates are used by the main menu and dropdown menus
(logged-in user menu and advanced mobile contributions 'more' menu).

This should result in no visual or HTML changes.

Bug: T342908
Change-Id: Idfad10b48c9ee9e833509e3c4063c6a4b014a31b
2023-08-03 13:11:16 +02: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
Daimona Eaytoy e9e3095a10 Convert MinervaPagePermissions to Authority
Move away from User, and use Authority instead. The only exception is
isBlockedFrom, which still requires a User object, so inject a
UserFactory for that.

Simplify the test accordingly, and also remove implicit assumptions as
to what certain user groups are or aren't allowed to do (e.g., watch
pages).

Also avoid using TestUser as it needs a DB connection.

Change-Id: Idfff8fd00f7b01df1dc6ec509dfc0cbd10ce7ce0
2023-07-17 20:11:23 +02: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
Umherirrender 7346ac5494 tests: Replace assertEmpty with assertSame
assertSame avoids use of loose comparisons and
allows to check the expected type

Change-Id: Icd903f3b4397896380e2a087d0e8029920d7be92
2022-11-24 22:51:26 +01:00
suecarmol 3efc6db04b Group.php: Hard deprecate insertAfter() function
Hard deprecated the Group::insertAfter() function because it is not used in the Mediawiki codebase

Bug: T311894
Change-Id: I209d3fd492713425a2727fd48c5870f983a39f9b
2022-07-07 17:27:24 -05:00
suecarmol 3e1cb1718f Refactor MainMenu building
* Created a buildMenuEntry function
* Replaced all Group::insert() functions with Group::insertEntry()
* Added a trackable parameter to check if a menu entry will be trackable
* Removed the MenuEntry class
* Removed the MenuEntryTest class
* Removed the Group::insert() function
* Changed tests in GroupTest to test Group::insertEntry() function

Bug: T221004
Change-Id: I39bed4e9a9b09f904cb3e5d78ccb3e6e175981a8
2022-06-23 18:29:05 -05:00
Jon Robson 8c57c9c12d Enable special page tabs
For now this should be a NOOP as the existing "special" page tab
is removed, put it paves the way for using tabs on special pages.

Bug: T286466
Change-Id: Ic0b52b298d598c20987b172c81c732a31e409402
2022-05-18 21:41:00 +00: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
lens0021 ea8c30b65c phpunit: Implement the new BundleSizeTest::getSkinName()
Bug: T305779
Depends-On: Id77c6124c9b1fd20633cda47bbca89f9b6724a63
Change-Id: Ia82018a31ff6ce2fe80946fd8f8d05a1dddf9523
2022-04-12 00:50:24 +00: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
Jon Robson 0b3d21d58d Main page definition come from MediaWiki:Sidebar
Bug: T291568
Depends-On: Ia54d01eb5d8d9c33d067f61c73203f9fec4569a6
Change-Id: Ia9998780dc0a5f51af52d928499b51d5566cf29d
2022-02-02 00:44:56 +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
Kosta Harlan d8c505c73a Move bundlesize test to MediaWikiIntegration test
Depends-On: Ieb7591f3c0ac843677a2a61b4ad47f920fc2ca2d
Bug: T255149
Change-Id: I311793952e995715010dc70069e1056165a1cd90
2021-12-10 08:43:51 +01:00
bwang ef4aa95ae2 Remove primary/secondary menu items, instead add a separate log out menu item
Bug: T293041
Change-Id: I9f73fdba1856dd9e0ea7120df0fb18061337961a
2021-11-18 19:51:33 +00:00
Umherirrender 993332734a build: Updating mediawiki/mediawiki-codesniffer to 38.0.0
Change-Id: I35e6bd738c78db48d98e1a870de4a28654d3d3f4
2021-11-13 18:58:14 +01:00
jdlrobson 5a7a9c9c31 Drop wgMinervaPageActions
Remove code per spike outcome (T226490#7438685)

- This configuration option is never used in Wikimedia production
- isTalkAllowed content body is merged into isAllowed. Resulting code
is more readable.
- isAllowed('talk') still returns false on main page for anonymous users
which is the current behavior. Even on sv.m.wikipedia.org where talk pages
are shown to anonymous users, we do not show the talk page on the main page.
Add a comment pointing to the associated phabricator ticket

Bug: T226490
Change-Id: I9f34817c5ad654a6a66fe6156850a3e3fee881a7
2021-10-21 17:25:37 +00: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 5263b09397 Standardize use of buttons and icons in Minerva
* Adds button hover/focus states to all Minerva button icons
* Removes the deprecated mw-ui-icon-before selector

Depends-On: I4eb28eae4c4e23d58f1f85bc41c0caf77197d8a1
Bug: T288678
Change-Id: I490534f9f704a733191b459c8ee071848c436001
2021-09-17 15:36:54 +00:00
jenkins-bot 8900f58e2f Merge "Replace categories button with HTML rendering" 2021-06-07 08:58:44 +00:00
Alexander Vorwerk 348e19ed5c Avoid using ContentHandler::getForTitle()
ContentHandler::getForTitle() is deprecated since 1.35

Change-Id: I52c40084d96e88b2edab46c15a10b83b7decf192
2021-06-01 19:17:58 +00:00
Jdlrobson 8651df02bb Replace categories button with HTML rendering
Bug: T246049
Change-Id: Id8c7493a525844b43c1628a1f4f09ae716ece2ba
2021-05-14 20:34:59 +00:00
libraryupgrader e9a4bec57c build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I325e6aabd1cd89cf5893ea8e85202765ed46a57e
2021-05-04 12:26:23 +00:00
Cindy Cicalese ff8ab4ea5c Replace Title::isWatchable() with WatchlistManager::isWatchable()
Bug: T281497
Change-Id: I0f7a82191eae8edd4c0c1d16d89c81e601ae5c80
2021-04-29 18:31:55 +00:00
ZabeMath 4cdd0af8bf Allow Users with permissions to do expanded actions in Minerva on mobile
Allow Users with the needed permissions to delete, protect or move pages in Minerva on mobile version.

Bug: T231291
Change-Id: I1e438b7d3683d288a8a6c5a9f5dcea6b3b3d9f71
2021-04-26 18:51:32 +00:00
Umherirrender ae03d13735 Use ::class for class name
This works also for non-existing classes,
because it is resolved on compile time

Change-Id: I84a9fc3c9f6c0ed3556b927e02e4ec9a5fef9cc2
2021-04-08 20:58:17 +02: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
Daimona Eaytoy dff83a4b24 Stop using deprecated Language methods
Change-Id: I46b6e388d96080ef0389601f01e2b2bb20cfd185
2021-02-27 15:59:17 +00: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