Commit graph

91 commits

Author SHA1 Message Date
Reedy 87bb746849 Namespace two more classes
Change-Id: Id32beb98df0f37ced858c17196517f65b64a041c
2022-03-04 16:33:46 +00:00
bwang a2d065c062 Update anon talk messages to show on non-main namespaces
- Loads messageBox styles on non-main namespaces
- Add messageBox styles to 'skins.minerva.scripts' module for MobileFrontend's edit overlay page
- Prevent warning box from showing with empty message

Bug: T284642
Change-Id: I70d0d86671384210cc3ab43cb1d350ff2a862fd9
2021-10-27 21:29:42 +00:00
jenkins-bot 29fc9d18ad Merge "Avoid using User::getBoolOption()" 2021-08-04 21:52:33 +00:00
Alexander Vorwerk 7dd62360a6 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with
UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: I8219efc4429bad692e80fd2314b57a6c89a893b2
2021-06-06 14:14:30 +02:00
Jdlrobson 8651df02bb Replace categories button with HTML rendering
Bug: T246049
Change-Id: Id8c7493a525844b43c1628a1f4f09ae716ece2ba
2021-05-14 20:34:59 +00:00
bwang 0071a28239 Ensure suppressed user pages look like unregistered users when viewed without proper permissions.
This patch removes the user page tagline (i.e. "Blocked joined 7 days ago"), updates the user page heading (i.e. "Blocked" becomes "User:Blocked") and removes user specific page actions (i.e. Contributions, User groups, the page actions submenu, etc) for certain user pages.

This patch also adds a new method to SkinUserPageHelper for use in the ToolbarBuilder.

Bug: T268961
Change-Id: I920e0770caa0a1b6d3323e2e3111e5df4f1f051d
2021-05-05 10:29:54 -05:00
jdlrobson 685387220f Message box styles for Minerva come from core
Just as before styles for message boxes will be
kept off the critical path of most page views and
loaded on special pages, old revisions and action= URIs,
however unlike before the CSS will come from the definition
in core.

It must also be loaded in JavaScript for compatibility
with the use of warnings in JavaScript, for example 
MobileFrontend overlays.

This change will allow us to remove the
mobile.messageBox.styles module in MobileFrontend
I8b6bdfceaf33b9527dbe6790d2a39e335fb692b2

Bug: T233160
Change-Id: I7d8d1d34621c36c26ec03a3773d4d1e67bd14f2e
2021-04-12 21:45:53 +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
Piotr Miazga (polishdeveloper) 82724b3c44 Add data-mw="interface" attribute to Menu elements
While dropping support of smart logout in favour of core ready.js
logout, we noticed that the logout selector is a little bit too weak.
Editors could make a link on a page that would work as a logout
button. The easiest way to prevent this (and any other possible
problems) is to add `data-mw="interface"` attribute to all generated
menu entries.

Change-Id: I22611b9641d82328623beb3f693bf7cddb2289ff
2021-02-11 20:35:40 +00:00
Piotr Miazga (polishdeveloper) 5a2527d71d Drop smart logout handling in favor of core ready.js
MediaWiki core added support of overrideLogoutSelector skin
config variable which allows us to define the logout button
selector. Thanks to that we do not have to ship our
custom/duplicated smart logout handler as we can use the
one shipped with ready.js.

Depends-On: Id313337c85229a5e8d0aada3a67d722048709597
Bug: T259200
Change-Id: Ie0192a176dfa8be994a544221aa71de75028d502
2021-02-11 17:26:47 +00:00
James D. Forrester 592e1151b7 Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: I60f714f42848898cf27aa83da92ac1c691fe5ead
2020-12-17 19:09:15 -08:00
jdlrobson ed0222b0d0 Remove client side error counting
Bug: T266359
Change-Id: I5350c801e7ecb7b8b28e54410cc57fd3b548b2ef
2020-10-23 11:09:22 -07:00
Jack Phoenix 2060ead391 Don't add the "minerva--history-page-action-enabled" class to <body> for non-Minerva skins like MonoBook etc.
Hooks are global, hence any and all skin-specific OutputPageBodyAttributes hooks need to check first that the correct skin (or skins) is used, otherwise the class or classes get applied for *all* skins when only one skin is supposed to be targeted.

Also fixed a tiny code style issue in the same hook subscriber while at it.

Change-Id: I626b0e050c614687b31f1ffbaea92e371dee4574
2020-08-03 20:30:28 +00:00
Peter Ovchyn 271fb28d99 Load mediawiki.page.ready on Minerva
Disable sortable and collapsible during mediawiki.page.ready initialisation

Add onSkinPageReadyConfig hook that overrides sortable and collapsible values.

Adds 1.74kb of JS to all page loads.

Bug: T257265
Bug: T250851
Depends-On: I0dc38e74052027f26a70d58b5f520e5830e0d55d
Change-Id: I81ff55d080c8c4a40f425ca7d0fc4fda322055dd
2020-07-29 20:57:52 +00:00
Derick A 568367a8c0 MinervaHooks: Remove unreachable code related to Special:MobileMenu
This is a follow-up work on: I30b1af8b88dd146d62f0de7a6352c4117a7cdd90.

Bug: T252005
Change-Id: Iefb56ad9b9c68196d06b96209a73e94aa69a1e2e
2020-07-24 15:43:21 +00: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
Ammar Abdulhamid 2bb3633530 Minerva: Use OutputPageBodyAttributes hook to add body attributes
This means dropping usage of Skin::addToBodyAttributes method from
parent Skin class to pave way for its deprecation/removal.

Bug: T255698
Change-Id: Idab13c37002ac5663f292e4f4b4ff51eb7573fda
2020-06-21 09:21:07 +01:00
Umherirrender 4f269d67b8 Explicitly format Message oject instead of string cast
The implicit in Mesage::__toString, as called when the object
is accepted by a method that needs a string, is to format
with parse(). Call that explicitly instead, or use escaped()
in places where it seems like elaborate wikitext isn't expected.

Change-Id: I9f1de3a0047d1f26d30c8607a0a79543d166176f
2020-06-01 20:52:33 +00: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
jdlrobson fa6255dfd0 Use standard getJsConfigVars method
Depends-On:  I1e2927a5ced077c8764ff7872ca033f487ae7cc7
Change-Id: Ia5aae659d9882bef7a273c709789437719303a35
2020-04-28 19:06:51 +00:00
jdlrobson d48ce1e729 Check title value before proceeding to check if user page
Bug: T245162
Change-Id: I7b826fb0e07a58947f381893604f308903c30304
2020-02-17 20:25:59 +00:00
jdlrobson db29aa53bd Make MobileFrontend dependency a soft one
This extends the work in Ie29a1eb7746d56f7d8c99b74e5e3c213c30fdcf2

Bug: T171000
Change-Id: Ib125e1bdaace1893804892909c27a9f328445835
2020-01-17 14:02:23 -08:00
jenkins-bot 9e370d9a84 Merge "Use User::getBoolOption" 2019-12-15 10:06:50 +00:00
Nicholas Ray ec93d34370 Resemble AMC mode for all users on user pages & user talk pages
This commit:

* Removes the blue secondary action links found on User pages

* Modifies ToolbarBuilder to add the contributions
icon into the toolbar when on a user page/user talk page.

* Turns on HISTORY_IN_PAGE_ACTIONS, TOOLBAR_SUBMENU,
TALK_AT_TOP skin options for all users on user pages / user talk pages.

* Languages icon is moved to overflow menu

* Remove $userPageHelper param from UserNamespaceOverflowBuilder as
it isn't using it and it is confusing to pass it in

Bug: T232653
Bug: T235681
Depends-On: I2138472e68d8cab1c50cbb42807bd5b79e7e2749
Change-Id: I940e5cf7638ff38686eeca3d41554b8a22d35615
2019-12-13 14:10:43 -08:00
Umherirrender 88df9f354a Use User::getBoolOption
The return value of User::getOption is passed to WebRequest::getBool,
that needs a real bool as default value, so using getBoolOption here

Change-Id: Ifc65f3e88c464afb0e620f3721422dad26bc1e47
2019-12-13 22:42:01 +01:00
Ammar Abdulhamid 898b048d1c Discontinue back-to-top feature
Bug: T237290
Change-Id: I06a6823bd3d1985a1d76384bb65c9d2ddf334a21
2019-12-11 05:12:43 +00:00
Nicholas Ray 071aa7a0c9 Enable Simplified Talk Page only on Pages With Expandable Sections
This patch should knock out two bugs we were seeing with the simplified
talk page:

1) Removes the "Add discussion" button and "There are no discussions"
message from appearing on Flow enabled talk pages.

2) Removes the "Read as wiki page" and "Active Discussions"/"There
are no discussions" message we were seeing on Minerva desktop talk
pages.

To address when the "There are no dicussions"/"Active Discussions"
message and "Read as wikipage" button are displayed, Minerva now listens
to MobileFrontend's `MobileFrontendBeforeDOM` hook and turns on the
simplified talk page (via a skin option) when this hook runs.

To address when the "Add discussion" button is added, a check was added
to SkinMinerva which only adds it to a talk page if the content model is
wikipage. Unfortunately, we can't just check the skin option because we
also want to display the button on desktop minerva.

Other changes:

* Moves around the logic in `getTalkPagePostHeadingHTML` for improved
readability

Bug: T237589
Bug: T237597
Change-Id: I83fd5cab174d90b24a5335f2b30c912c3b68040a
2019-11-20 21:41:43 +00:00
Piotr Miazga f9c055e7f5 Remove Share feature
The feature got into Beta in over a year ago and never made into
the beta mode. For most of the time it was disabled for all users.
There is no need to keep this code as it is dead code now.

Change-Id: I9037f58b97373195e9d1b9f57789a6c531f42831
2019-10-28 12:54:14 -07:00
jdlrobson 8ee17cf2b0 Remove wgMinervaErrorLogSamplingRate
We are counting errors rather than sending them via EventLogging.
This code is thus being shipped unnecessarily to our users and is
not ever enabled in production

Given our work to use Sentry (T106915) let's remove this code.

Bug: T233663
Change-Id: I71ef7377e91e38f9ccc13493d52ab629d433f8f4
2019-10-03 14:57:14 +00:00
jenkins-bot 1dd359d824 Merge "Migrate from onResourceLoaderTestModules to QUnitTestModule" 2019-09-23 18:37:46 +00:00
Timo Tijhof 30c12b3ddd Migrate from onResourceLoaderTestModules to QUnitTestModule
The hook is deprecated as of this release cycle, see:
<https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules>.

Moving away from PHP code. This can now be done from JSON, and
encourages use of a single module that is automatically named and
registered as needed.

Change-Id: I382692c70ca8e5f5ea658b07ebea6c47dd541724
2019-09-20 22:14:56 +00:00
Timo Tijhof f91aca18f3 Use cheaper ConfiguredReadOnlyMode instead of live Database check
Follows-up a0071643d3.

Bug: T233458
Change-Id: I8b3199d7be15aa19f3a0d313d4df926ea877d566
2019-09-20 22:07:30 +01:00
jdlrobson 497044290a MobileFrontend is now managing the toggling code. Remove.
Depends-On: I6bdeb7198082c4b1d0a32960cc4dc679ff4c6762
Change-Id: I1815a730fc12f68c287d58f2de6f92e05db3abd2
2019-09-06 15:50:00 +02:00
jdlrobson 9150aec131 Feature flag overhaul
Two new feature flags:
1) MinervaPersonalMenu
2) MinervaAdvancedMainMenu

Changes:
* AMC defaults to false on desktop - desktop doesn't have AMC mode it just
enables several skin options.
* WHen inserting a link at the bottom of the page check whether the talk at top
of the page (tabs) is enabled.. not AMC
* Update ServiceWiring to construct menu based on MinervaAdvancedMainMenu
and  MinervaPersonalMenu - note when former is enabled but not latter there is
no way to logout. Noted in README.
* Use one entry point for skins.minerva.amc.styles/index.less
* Document files inside skins.minerva.amc.styles to make it clear which features
they are associated with
* Drop history page styles when AMC is disabled - it's not possible to ever get to
these as the history page redirects in non-AMC mode
* Rename the class .minerva--amc-enabled to minerva--history-page-action-enabled
to reflect its real purpose and move styles from skins.minerva.base.styles to skins.minerva.amc.styles
No need to worry about cached HTML as AMC runs without cache...
* Remove isAnyAMCOptionEnabled - it's an antipattern and should be discouraged as it discourages the
art of feature flagging. Nothing is using it after these changes.
* The AMC_MODE flag is disabled. There is no need for this - AMC is not a feature and therefore not a
skin option. It is a mechanism for turning on other skin options. Tests are updated.

Testing:
It should now be possible to enable any feature in `beta` and see it in the beta of the
site.

Bug: T229295
Change-Id: I48959905f5c09721b14a27aa1a5ad82849ac6263
2019-08-23 10:48:14 -07:00
jenkins-bot 7c869ec86a Merge "Remove all main_menu tracking related code.""" 2019-08-02 14:06:23 +00:00
jdlrobson 97f0e44e19 Reset SkinOptions after logging out
Bug: T221137
Change-Id: I36ada157327b649900dbcee3917883fe8ee7687a
2019-08-01 21:57:36 +00:00
Jdlrobson 8d703b7758 Remove all main_menu tracking related code.""
This reverts commit de353c06c9.

Bug: T228681
Change-Id: Idfd964c31e09e271dca9ac39f7932df49cdcb5f6
2019-08-01 10:40:09 -07:00
Piotr Miazga 4efd72a879 Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions
Additionally, renamed couple options for better readability.

Bug: T221012
Change-Id: Ia347a60d469fba8f35afa7c70aa806a46271dccd
2019-08-01 10:34:03 -07:00
jenkins-bot e030193ced Merge "Limit Recent Changes disable-table mode to Minerva skin" 2019-07-31 19:01:41 +00:00
jdlrobson c4c0254963 Limit Recent Changes disable-table mode to Minerva skin
Bug: T228280
Change-Id: I6e2298d3721ec0d09f8867af89f22d26210ed6bb
2019-07-31 11:39:40 -07:00
Piotr Miazga 7b5e210ed8 Show warning when user tries to use enhanced RecentChanges view
Bug: T228516
Change-Id: I16e3d69b410f20a3f70f4bb213a279664613f725
2019-07-31 15:32:58 +00:00
Derick Alangi ddf6dece1a 💩 Avoid usage of deprecated isFeatureAvailableInContext() method
Change-Id: Ic7459fc7630ee6add20415ce632d39c118913645
2019-07-30 12:45:04 +00:00
jdlrobson 6830ffcfea Disable the recent changes table-based layout on Minerva
See Ib68ff8fa782ac12479ef02247cdf78e405b64bad

Bug: T228280
Change-Id: I4169bcb93eb6680c0e9251873afb5637014c0e1b
2019-07-22 23:29:04 +00:00
Pmiazga de353c06c9 Revert "Remove all main_menu tracking related code."
This reverts commit d11c84d08b.

We decided to track both old MobileWebMainMenuClickTracking and new MobileWebUIActionsTracking for some time. Then once everything goes stable and it's proven to work correctly we will merge d11c84d08b.

Bug: T220016
Change-Id: Ib4d52e8b8c870774041284e575564a9933af6136
2019-07-22 18:31:55 +00:00
Piotr Miazga d11c84d08b Remove all main_menu tracking related code.
This code should live in WikimediaEvents extension, not in
Minerva.

Bug: T220016
Depends-On: Ic2d6d1b21b0eb72ad68b0c447bc63f7d1bb021f4
Change-Id: Iaeb12704dcd257f0783f1ebec3def01cb2848228
2019-07-19 15:30:28 +00:00
jdlrobson 72df451bd3 Embrace packageFiles
Help with readability by using module.exports and require rather than the MobileFrontend
provided mw.mobileFrontend module manager (and avoid adopting webpack at this time)

Replace usages of mw.mobileFrontend.require with local require and module.exports
(compatible with RL or Node implementation)

Changes:
* Notifications modules are merged into skins.minerva.scripts and initialised
via a client side check.
* new file overlayManager for exporting an overlayManager singleton
rather than being hidden inside resources/skins.minerva.scripts/init.js
* All M.define/M.requires swapped out for require where possible
The `define` method is now forbidden in the repo.

Bug: T212944
Change-Id: I44790dd3fc6fe42bb502d79c39c4081c223bf2b1
2019-07-16 18:04:10 +00:00
jdlrobson 9b4c22f31f Update page issues folder structure
Tests are untouched as these will be moved to headless
node-qunit in a follow up.

Bug: T212944
Change-Id: I3d9b43387e34fd49827e3ab62420f3555ff4b3cd
2019-07-08 23:07:28 +00:00
Kosta Harlan 1e87c62191 Add hook to override SkinOptions, and allow overriding tabs output
Bug: T222835
Change-Id: I0d390eadbd0a8de7f328360df5c60d9fb2225db1
2019-06-04 10:24:30 -04:00
Stephen Niedzielski 815f3386e3 Update: add secondary page actions submenu in AMC mode
When advanced mobile contributions mode is enabled and
`$wgMinervaOverflowInPageActions` is set, show a secondary overflow menu
on main namespace articles and user namespace pages. The menu content
varies for each namespace. The new submenu is *disabled* by default,
even when AMC is active. This feature should not be deployed until
instrumentation is available.

The secondary menu is rendered in PHP using the existing menu system
with some changes to the template. The checkbox hack is needed for no-
JavaScript keyboard navigation until :focus-within is supported. CSS
additions are documented in the source.

All client side toolbar execution occurs in Toolbar.js. Enhancements are
documented in the source.

Minor changes to the existing download button:
- Move download and edit button initialization to Toolbar.
- Update copy (not visible) from "Download" to "Download PDF".
- When the overflow menu is present, use the "hasText" / label style.

Wikimedia UI icons are copied from OOUI at d00a0ac and seem useful to
expose as HTTP URIs (not data URIs).

The overflow menu does not show for pages provided by the content proxy
since its entries depend on $tpl->data['nav_urls'] being populated.

Bug: T216418
Depends-On: I0781151a8232b6a7b52f79a34298afcecb8e4271
Change-Id: I4b50a0e519024a7ab91dae6ab40b23cf14a03861
2019-04-19 14:51:17 +00:00