Commit graph

91 commits

Author SHA1 Message Date
gerritbot 6419c847e9 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I5a540772aafd2c4686e02f748b5fc61155920397
2023-11-29 12:41:59 +00:00
jenkins-bot 47d023c767 Merge "Do not use data-mw=interface when watchstar is used as a CTA" 2023-10-23 21:14:54 +00:00
Martin Urbanec 8b04c45fb2 Do not use data-mw=interface when watchstar is used as a CTA
Why:
Minerva uses watchstar both as a client to action=watch
and as a CTA prompting users to create a new account.
To prevent error messages about permissions from being
displayed when logged in as a temp account (or not logged in
at all), the API requests should be only sent when users
actually has watchlist permissions.

This patch fixes that by only passing data-mw=interface when
the watchstar is actually used as part of MW watchlist interface,
ie. when user is logged in. That means the `mediawiki.page.watch.ajax`
module in core can avoid the watchstar element when it is not meant
as a watchstar, but as a "sign up" CTA button.

What:
* Make it possible to change (or omit) data-mw in SingleMenuEntry
  by a new constructor parameter.
* Make ToolbarBuilder::createWatchPageAction omit data-mw when
  user does not have watchlist permissions.

Notes: Based on coversation with Krinkle in
Ia0acdaf4dea5aa6788f89fdd73c5dba9af9f1ed7.

Bug: T344925
Change-Id: Id9d6d9e7394b52d11ac6ce0b7d33319b3a761789
2023-10-23 08:59:08 +02:00
Umherirrender dd5753c023 Replace empty() with falsy check
empty() should only be used to suppress errors
When the type of the variable is array,
a falsy check is the same (checks for null, false and empty array)
Found by a new phan plugin (T234237)

Change-Id: If24015795219f6ff4f155c0d667472dc52a04d43
2023-10-21 20:29:41 +02:00
Jon Robson 7d59aa1843 Restore watchstar for anonymous users
Minerva shows a watchstar for anonymous users.

Follow up to
I3c9d59f49f1b939981a7b2b450448db6736d5958

Bug: T348336
Change-Id: I36afb86f0c89c30dcb7695e1409f7c20d3dc31d1
2023-10-06 18:05:08 +00:00
Jon Robson 05231bb254 Support extension of page actions via hook and addPortletLink
This adds support for:
mw.util.addPortletLink('p-views', '#', 'text', 'fooz',null,
  null,'#page-actions-overflow' )

and adding multiple edit icons via hooks.

Depends-On: I655097769620301143140ded1cde4c7a16879ef4
Depends-On: I401805224c0f387ac85b52b50c1f298b83c03a91
Bug: T346944
Change-Id: I3c9d59f49f1b939981a7b2b450448db6736d5958
2023-10-04 22:15:47 +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
bwang c188fac106 Clean up setIcon now that classes and icon types are removed
Bug: T319260
Change-Id: I354dafd6bea92ef61f6d25b5943ef9d933daa2a0
2023-08-24 21:37:40 +00:00
Jon Robson 952789bc17 Switch Minerva button template to use Codex and remove mw-ui-button
- Removes 'mw-ui-icon-with-label-desktop' as that is now the default behavior for icon only buttons in Minerva
- Removes icon flushing classes, use codex mixins instead

80 Visual changes relating to minor icon/button subpixel changes in the heading, edit section links, and page actions

Bug: T319260
Change-Id: I503b643d33e43196483af4b5f9dd312237322ac8
2023-08-24 15:57:01 -05:00
Martin Urbanec 0109b17483 watchlist: Don't assume only named users have watchlist access
In I1ccda3878a658d4251429ae65ebee04c09d81243, core decided
to technically allow temp. users to have watchlist access,
but have it disabled on permission level
(viewmywatchlist / editmywatchlist) instead of by isNamed() checks.

Minerva expects the watchlist permissions to be assigned to everyone,
but actual watchlist access to be available only to named user.
This is an incorrect assumption. Make a clear difference between
"page is watchable" concept (watch icon should show) and "user has
permission to watch" (if not, CTA to log in should show).

There is one additional step to fix, which is ensure
temp users receive the T330518 drawer. That is not a bug
in MinervaNeue, but in core -- mediawiki.page.watch.ajax.js uses
e.stopPropagating(), which means Minerva's CtaDrawer doesn't get
a say. Ideally, mediawiki.page.watch.ajax.js would know whether
the user has permissions to edit their watchlist. Alternatively,
it could have an interface to allow extensions to add their own
error handling. See T344925 for details.

Bug: T344870
Change-Id: Id1757fb4fb433fe39cf4d5c6e1e9c65ab5abae14
2023-08-24 14:12:43 +00:00
Umherirrender 4ce42dd5cb Use namespaced MediaWiki\Html\TemplateParser
Bug: T321681
Change-Id: I7cec363ce0f4a6d5797a3f176b5cb766930a84fe
2023-08-20 02:48:10 +02: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 b7b4e4b01f Remove icons from about and disclaimer link and minerva-icon class
Legacy icons shouldn't have the minerva-icon class as this is meant
to be reserved for Icon template (Codex icons)

Bug: T342908
Change-Id: I63556fe42c8650bc5f0d6e5a0c5328b3f29d75f3
2023-08-11 11:56:08 -07: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
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
Thalia 53b524fbd3 DefaultMainMenuBuilder: Use UserIdentityUtils for temporary user check
Use instead of UserNameUtils, which has more dependencies.

Change-Id: I32ca33acf2511048a8c307c20a1f1a73c9fc3cf4
2023-07-27 18:02:36 +00:00
David Lynch 956baf5b55 Add "edit full page" to the minerva overflow menu
Bug: T203151
Change-Id: I2777a8346ab672ce2b4fcf37b19fd12ab5541224
2023-07-21 20:00:15 -05:00
MusikAnimal c8ce92140e DefaultOverflowBuilder: allow CSS class names to be applied to entries
Use the SingleMenuEntry constructor rather than the static create
method so that items can not only supply class names, but also with
array to string normalization.

This is useful so that extensions can add links with JS interaction,
such as with Ib3fe1063187

Bug: T242467
Change-Id: Ice909aab7f9ce49f36a954ac1bfce5eef14d30fc
2023-07-10 11:55:27 +00:00
bwang d977c8d940 Update personal tools for temp users, add icon for temp users
Bug: T335546
Change-Id: I56315440016cde3aad051b37895f713fbb5dd239
2023-06-20 13:19:55 -05:00
Jon Robson ffbcf9e2eb Fixes: Sandbox link should not show in main menu
This was inadvertently added in
I3c08e804cbb778f025f45a184801cd7b1738c035 and is without
an icon.

Bug: T336838
Change-Id: Ie6a588297a586328faee514074e096e78989547d
2023-06-12 15:21:23 +00:00
Jon Robson 567dd022ae Move to exclude list rather than include list
Follow up to 13d536a26

The current behaviour is unexpected and led to T336838. It also
seems like at some point the instrumentation for these menu items
also broke.

Going forward it would be easier to simply show any menu item which has
an icon. Also make sure that all menu items have a data-event-name
attribute so clicks to these menu items are captured.

Fixes:
* Contribute link is now not shown for anonymous users
as it was before

Changes:
* Ordering of menu items changes - settings is now below username
which is consistent with user
* All menu items are now tracked via event names consistent with
desktop.

Bug: T321746
Bug: T336838
Change-Id: I3c08e804cbb778f025f45a184801cd7b1738c035
2023-06-09 23:06:39 +00:00
Daimona Eaytoy 1898a3ccab Replace deprecated MWException
And more generally remove `@throws` comment used for unchecked
exceptions, callers must not catch them.

Bug: T328220
Bug: T240672
Change-Id: I4768144d02feb6d4b6bae1a1ad39af6031f9613f
2023-06-08 17:16:36 +02:00
Santhosh Thottingal 13d536a26d
Show Contribute menu item in main menu when Special:Contribute is enabled
Bug: T336838
Change-Id: I32662dcb244a019bc8878c8b98f46370d4156eda
2023-05-25 13:27:39 +05:30
Jon Robson 132a2ab7e8 Standardize user overflow menu
Make it behave just like the normal page actions menu, taking
its data from the core toolbox definition. This will allow it to
be extensible by extensions who declare an icon field for their
menu item.

Follow up to Ifd10da690a33e7fc5790a7b444b62fbfd1b95d98

Depends-On: I6881785676e2909434991b633ac181d05a272352
Bug: T335603
Change-Id: I88ac38acf22fbce0c3e0a4f4c6efcaef4ca49907
2023-04-28 19:33:43 +00:00
Jon Robson 831e3d93b7 Drop dead code relating to Minerva-specific messages in overflow menu
Remove an unnecessary line as follow up to
Ifd10da690a33e7fc5790a7b444b62fbfd1b95d98

Change-Id: I6f279d116d94c9840d453a3b50ea8ac6b66e7433
2023-03-28 16:31:21 +00:00
Jon Robson 666ebaae96 Make toolbox and actions menu more flexible to extension
Adjust the behaviour so the existence of an icon is all that is
needed to populate this menu. This will allow discussion tools
to extend the menu with their own item(s)

Depends-On: If2972da4456705f4a2f0cea90e73d0207a36a306
Depends-On: Ia9a9a08c68be652c16692db30e0efbe02fbfba0d
Depends-On: I2b85b9ac6997d07ed4ff995693f083d0ad1216dc
Bug: T332730
Change-Id: Ifd10da690a33e7fc5790a7b444b62fbfd1b95d98
2023-03-23 17:25:50 +00:00
jenkins-bot e5caabc136 Merge "Add languages to Minerva HTML" 2023-03-17 23:29:45 +00:00
Jon Robson b28d802693 Add languages to Minerva HTML
Bug: T331905
Change-Id: I55a25dfb8aba3d1b589a36ba4cba3bba0fe710a1
2023-03-17 20:37:32 +00:00
Func e1c51814ac Remove unused constructor params of MainMenuDirector
The code was simplified in commit 1f94dbb, and these params become
unused.

Change-Id: Ie830200dd5b5fa3472300a27abc77cf88a2be324
2023-02-26 20:30:07 +08:00
ksarabia 23aa23b68b Remove the Group::insertAfter() function in Minerva
Bug: T311895
Change-Id: Ice77bac6fb6ba948f3054c18d558f79ffd46506d
2023-02-08 16:52:42 +00:00
Reedy 8d23e02358 Group: Fix string interpolation
Bug: T314096
Change-Id: Ie61a2b703585d9f1bb3d0b0018f043a5a62c77d5
2022-11-04 14:45:21 -06:00
jenkins-bot 67b54fd33c Merge "User menu overflow: add change block and unblock" 2022-07-18 17:47:35 +00:00
suecarmol 3c556a5bf1 Bugfix: Insert Nearby menu entry to group
After refactoring and simplifying the menu building, the Nearby option wasn't getting inserted into the Group.

Bug: T312864
Change-Id: If52ac42f64154e015eab8f97393e4255db23473f
2022-07-12 11:22:59 -05: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 207705fced User menu overflow: add change block and unblock
Added the "Change block" and "Unblock user" to the array of possible menu entries for the overflow menu. These buttons will only appear when a user is already blocked.

Bug: T308570
Change-Id: I987083cfeb20a0c691d3fc631a9c844647fec9bf
Depends-On: If60a1194d63fff2b7b5ae1565be25a3b7b44fdf1
2022-07-01 12:21:33 -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
bwang d5d94e6b6f Add settings menu item for anon users
Bug: T307696
Change-Id: Ib875bae5796ef021a06310582a4bbc41abb26555
2022-05-23 22:36:36 +00:00
jsn 7959e9fa08 Add block button to user namespace overflow
Bug: T307341
Change-Id: Ib8bcca0ab284900eff01468a416177435f02e7aa
2022-05-04 10:59:16 -05:00
bwang 79d4130fcc Hard deprecate MobileMenu Hook
Bug: T303309
Change-Id: Ice45416c4af4e8fd4bcda158c5f9b81e6c8c9491
2022-04-27 12:38:03 -05:00
Jon Robson 0fe451b23a FIXME cleanup
- Remove cached HTML relating to heading change
( I2ffdedd64414ffb3c6e441391a75fd6e744847a4)
- Update invalid instruction for selector in footer (I0bfc7f977cdaf5ce8873103346c64121d704b86c)
It appears this rule cannot yet be removed.
- Update classes for contributions icon on user pages
(I6c908acd70c0dca5bcb1754d1b25d3da2389feb8)

Change-Id: I271abf3d29dfcfd19d654514fb3f6d6e257505ab
2022-04-06 20:17:22 +00:00
jenkins-bot f3565a4d7c Merge "Replace Title::newFromText by Title::makeTitle" 2022-03-13 21:56:31 +00:00
Umherirrender 3ed8be2752 Reorder checks in Defintions from cheaper to expensive
Check the messages first and only parse the Title if needed
Use local variable to avoid repeated call to functions

Change-Id: I376d06b807183fb23cb07ad33ee54b387beea6f9
2022-03-10 23:05:13 +01: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
Reedy b6685f9c4a Namespace SkinMinerva
Change-Id: I8f6bddac9f8cd060c551651e711ee987b8bbfbe3
2022-03-04 17:50:20 +00:00
Reedy 87bb746849 Namespace two more classes
Change-Id: Id32beb98df0f37ced858c17196517f65b64a041c
2022-03-04 16:33:46 +00:00
jenkins-bot 6d4558de86 Merge "Deprecate MobileMenu hook" 2022-02-28 22:09:18 +00:00
Umherirrender 3dd1fd841a Use new namespace for MediaWiki\SpecialPage\SpecialPageFactory
MediaWiki\Special is alias since 1.35

Change-Id: Ifb8a64c5fe7e413178f94ecc89b7a960d04064b2
2022-02-26 22:31:38 +01:00
Jon Robson dc422a3def Deprecate MobileMenu hook
Bug: T291568
Depends-On: I2c75e210ac914ee4d63969314c82451fc8172da0
Change-Id: I00c3e0d4178447c547f25be580c5b99ee65bef60
2022-02-22 18:18:42 +00:00
Jon Robson 0659e174c9 Allow msg key to be overridable
Minerva already overrides the text label for the Home menu item.
To allow other extensions to override it again, we can also consult
the msg key.

Bug: T291568
Change-Id: I3107a6d1e6ace26c7ab9c49c49768d2adcda8792
2022-02-17 16:44:37 +00:00
Jon Robson d8a1942808 Handle unexpected data coming from MediaWiki:Sidebar
Bug: T301003
Change-Id: I27fbd952f3c6139b00e8793a55044f451446a867
2022-02-04 13:16:40 -08:00