Commit graph

83 commits

Author SHA1 Message Date
Umherirrender ea4fd5d182 Create a FeatureManagerFactory
Some feature requirements needs access to the request user or title.
Currently the context is given in the ServiceWiring callback,
access to RequestContext::getMain() should be avoided during service
wiring (T218555).
Create a factory to hold the code from the service wiring and call the
factory with the request context from the skin to get a feature manager.

Bug: T359665
Change-Id: I57515ec02ed454620f729a109d0ace43b447b6ce
2024-03-08 20:28:31 +01:00
bwang e964cbb785 Add Vector night mode feature flag
Bug: T355065
Change-Id: Ica63eb61ee042e8684168f6787b27a5e58e38bee
2024-02-05 11:33:37 -08:00
Umherirrender 4c5d039f13 Add return type hint to function in ServiceWiring.php
This is a common pattern for service wiring functions

Change-Id: Ia7bb6e22ca56aa263288fbf3afed5fb3c5d2df1a
2024-02-01 19:51:03 +01:00
Moh'd Khier Abualruz f83cca3cc5 [Zebra] Merge skins.vector.zebra.styles module into skins.vector.styles
Merges all of the styles in the Zebra module into the default styles.

- skins.vector.zebra.styles ResourceLoader module is removed.
- FIXME's related to Zebra styles are removed.
- Top-level "&" that were used for scoping to feature-flag are removed.
- `$wgVectorZebraDesign` feature flag is removed.

Bug: T347712
Change-Id: I0177541ae87a5d070d5317629ca38de93613d620
2024-01-09 15:46:11 +01:00
ksarabia 515af497db Remove typography survey
* Removes code related to typography survey

Bug: T349337
Change-Id: Iae871ec0c61d630078108a5710705b4d3d118a54
2023-12-05 14:32:00 -06:00
bwang e7ebeec623 Fix incorrect client-pref-pinned classes when client pref feature is disabled
Bug: T351141
Bug: T352257
Change-Id: I2d527ee9a943feabb8c8ea26fd1078fd3721f625
2023-11-29 20:14:49 +00:00
bwang d2b413a721 Make client prefs fully pinnable
Bug: T351141
Change-Id: Ic4a166fb3234b27dbf3d37891abfdf15781c8867
2023-11-22 14:39:28 -06:00
Jon Robson 0a33ffffac Remove Zebra A/B test code
Additional change:
* Remove duplicate A/B test requirement for language in header

Bug: T339957
Change-Id: I0258e71ac0e270682ec1f3bcb0f10198892f058d
2023-11-13 21:56:34 +00:00
Jan Drewniak dcdcecd3db Add config option to disable Readability survery & minor fixes
Adds a config option to control the Readability prototype
survey tool on a per-wiki basis.

Minor fixes:
- Adds missing i18n messages to the tool for slider labels
- Ensures tool only runs on Vector 2022 skin
- Wraps the initialization in an IIFE

Change-Id: Ia65a0043dab5e9a23d4ef401ed83914e4f3d2882
2023-10-16 00:45:59 +00:00
Jon Robson 411f9ce69a Allow user preferences to be overriden by query string parameter
Currently only features that are associated with LocalSettings configuration
can be overriden by query string. Going forward we'd like to expand this to apply
to user preference too.

A generic OverrideableRequirement is created.
The existing OverridableConfigRequirement is refactored to extend OverrideableRequirement
The /UserPreferenceRequirement now extends it

This allows http://localhost:8888/wiki/Spain?vectortypographysurvey=1
to work

Bug: T347900
Change-Id: I11efd6b07192d5d2333f4506e9d87a8c0638d657
2023-10-12 19:05:10 +00:00
Jan Drewniak d4246e6ca6 Web typography prototype survey
Creates an interactive prototype for gathering
feedback on users typography preferences.
This prototype is meant to be temporary and is
built soley for feedback purposes for the
WMF Accessibility for reading project.

The prototype code is:
- for logged-in users only
- hidden under the API user preference "vector-typography-survey"
- disabled by default

It is intended to be enabled via a banner that calls
code similar to:
    new mw.Api().saveOption( 'vector-typography-survey', 1 )

Bug: T347208
Change-Id: I8d8914a0fa16d40cb22ed0e61832bc5bbabe1c78
2023-10-02 10:56:40 -07:00
Jon Robson d35db97615 It should be possible to persist Vector font size for registered users
Bug: T346987
Change-Id: I01e0fac5ba781480ee32a8b32f6ef7fafb8d1ca5
2023-09-27 20:04:22 +00:00
Jon Robson 65c48d4eb2 Feature: Client preferences interface
Notes:
* This is functional but intentionally not designed until the design
has been finalized.
* A feature flag is added that swaps out the limited width toggle with
a settings cog
* The preferences module is kept in a separate ResourceLoader module
(skins.vector.clientPreferences) to make it more portable for
when we eventually want to add it to Minerva as well.
* Intentionally have not focused on non-jS version given we will
likely revise this again in a future version/upstream to core.

Bug: T345363
Change-Id: I0c793b73e0676e32f031c6168c292f63908c72e3
2023-09-15 10:03:28 -07:00
ksarabia 1805561923 Add font size feature flag
Add feature flag that for new (eventually customizable) font size.
Enabled via url param VectorCustomFontSize=1 and font size set to
a hard-coded 16px value for testing purposes.

Bug: T343928
Change-Id: I75801db7506ba2a8212df94bb2079c33a3b64614
2023-08-24 20:57:46 +00:00
ksarabia 9fbed3eb7f Remove centraluserid dependency in ABRequirement.php
Removes centraluserid and replaces it with local user id.

Bug: T336969
Change-Id: I5abedf62fb92cb08fbcaf09f6d19ab45fcfc9819
2023-05-23 15:03:59 +00:00
Jon Robson dbf3931515 Query string override should support camel case as well as lowercase
- ?vectorzebradesign=1 and ?VectorZebraDesign=1 now enable a feature
- Drops the parameter from OverrideableConfigRequirement which was leading
to the inconsistency

Change-Id: I4e124b6de2e5a0e46804036c6ac3f97fd2af4d81
2023-05-03 16:56:42 +00:00
Nicholas Ray 29b982999f Remove language switching alert box temporary feature flag
Remove everything related to the `wgVectorLanguageInHeader` feature flag and
rely on the LangaugeInHeader feature instead.

Bug: T297237
Change-Id: Ida2c588e03f759d2eefc7c67ff44dcdd9a100f9a
2023-04-27 14:57:18 -06:00
ksarabia f2dbf8508e Follow up service wiring update
This modifies the ABRequirement.php and ServiceWiring.php file.

Bug: T333493
Change-Id: I3e5cb7499b36cd5c894e8b5527f77a9cc94b5165
2023-04-19 23:04:53 +00:00
Jon Robson a76e198523 Remove A/B testing element from OverridableConfigRequirement
Superseded by ABRequirement. Having this code here is confusing
and might lead to non-standard A/B tests being defined.

Change-Id: Ifd9d2b7249250a73e7f6e4f9d6b51c322ef2759d
2023-04-19 01:41:53 +00:00
ksarabia 8cdb773026 Add Vector Zebra Design A/B Test
Adds Zebra A/B test configuration

Bug: T333493
Change-Id: I56f66e19dd3fab2007de50d665f077a4ee01a6e4
2023-04-18 18:14:58 -07:00
Jan Drewniak 40bbb8c3a9 remove Page Tools config & HTML
Removes the config option for Page Tool menu,
its associated logic, along with the associated HTML from
the mustache templates.

Hardcodes the `vector-feature-page-tools-enabled` class
into the HTML element to prevent breakage.

Bug: T332090
Change-Id: I6466d80c6970bcc8e28d897b6bdff911a90e3655
2023-03-30 11:32:36 -04:00
Moh'd Khier Abualruz 47b82f6034 Create feature flag for Zebra#9 design update
- Create a feature flag that will enable/disable the upcoming zebra design
- This feature flag will add a class on the `body` html element that will enable & disable the new design.
- class names:
 -- enabled: vector-feature-vector-zebra-design-enabled
 -- disabled: vector-feature-vector-zebra-design-disabled

Bug: T332448
Change-Id: I264f2a338130e95543c20b592addf954a119b56a
2023-03-28 22:02:26 +02:00
ksarabia 74addde337 [WIP] Removes the TOC class in body and adds in html
Adds new constants for TOC and registers feature.

Bug: T325032
Change-Id: I5e0f5f3a6d186b245bdbc98c2bb9e4cc17a03fdb
2023-02-28 17:21:16 -06:00
Jon Robson 93c833030b Make sticky header edit the default
In production this is always true, so remove feature flag.
Retain A/B testing code in case it is still needed.

Bug: T324799
Change-Id: Ia2057eb69d0a8d3e6e51acb5729a4399fb17a18b
2023-01-24 19:48:48 +00:00
Dreamy Jazz 9d265af32f Test ServiceWiring.php
Test ServiceWiring.php using tests copied from CentralAuth. Because
phpunit does not support marking a file as covered, the file is
marked as ignored for code coverage. However, these tests do not
fully cover the single service as these tests only verify that the
call to the service does not result in an error.

Change-Id: I6100d242aa61975cab7c44b35616cb2b19762cbf
2022-12-24 01:07:25 +00:00
bwang 6c817e932f Use features.js for main menu pinning functionality
- Register new feature for main menu pinned
- Update UserPreferenceRequirement to optionally handle default config values
- Add nav landmarks for the main menu

Bug: T317900
Change-Id: I8fc6e0a79a1155d68afb9e33e5101a2a160dc4e5
2022-12-16 12:56:54 -06:00
bwang 81348a659c Remove TOC AB test code
While removing this we also noticed that we check the value of
isMainPage. This doesn't seem like a good idea as most main pages
do not have a table of contents, so it seems like adding
unnecessary complexity for a state that doesn't exist in practice.
The existing code path also doesn't work as it adds a table of contents
unstyled to the page.

Bug: T324874
Change-Id: Idaeff6ace5912ea74ed9d335526027c4690ac8fa
2022-12-09 16:07:52 -08:00
Nicholas Ray 24055a6752 Set default pinnable state for page tools
* Leverage the infrastructure around feature management to handle the page tools
pinning and persistence

* Make pinnableHeader.js leverage features.js if the data-feature-name attribute
is set

* Sets tests/.eslintrc.json ecmaVersion to 2018 to enable destructuring in test
files.

* Adds a isPinned helper method to pinnableElement

* Add a logged in requirement so that the pinned feature is disabled for
anon users.

Bug: T322051
Change-Id: Ib86282216882fa94e37b7088a3f4bd0c1bcf6cd4
2022-12-08 14:44:07 -07:00
Nicholas Ray 7e0dd79d5a Convert LimitedWidthRequirement to UserPreferenceRequirement
Generalize LimitedWidthRequirement into a more reusable
UserPreferenceRequirement that can be used by both the limited width feature and
the persistent pinning feature (and possibly others in the future).

* Removes existing logic that checks whether the option is not null. Given that
skin.json sets the default [1], presumably this isn't needed.

* Adds unit test

[1] 65af26a258/skin.json (L163)

Bug: T322051
Change-Id: I7f228cf81a65b2eb22dbe94d2384b6c9f6da91f2
2022-12-01 16:31:47 -07:00
Jon Robson 7c24aa46fb Drop the VisualEnhancementsNext feature flag
Bug: T320101
Change-Id: I6d536af034dafd66c6478183de8029be9ed3e8b7
2022-11-21 13:27:34 -08:00
bwang 2102ac5131 Rename Article Tools feature flag to Page Tools
Change-Id: Iec8e790d0a49d7bb8bbdaa3caee7aae72eed0868
2022-10-25 16:53:43 -05:00
Jon Robson 614da1dc5e Features: Make max width a feature
Making this a feature part of the feature management system is integral
to making this a toggle and will allow us to explore making this
persistent in future.

Bug: T319447
Bug: T319449
Change-Id: I80c7b892a6891094854b4154db90917b67986102
2022-10-24 13:12:06 -07:00
jenkins-bot ba7fda1a69 Merge "Update name of body class to avoid confusion" 2022-09-29 14:58:38 +00:00
bwang e7944de81c Add Article Tools feature flag
Bug: T306609
Change-Id: Ia40af4e48c006aeceebd3879ff0aaecbe1b200d4
2022-09-28 15:41:30 -05:00
Jon Robson 6b7bc78bae Update name of body class to avoid confusion
The class vector-feature-table-of-contents-disabled is confusing as
it shows on pages with table of contents. What it actually means
is the A/B test is disabled. This change gives it a more meaningful name.

Use the class name vector-feature-table-of-contents-legacy-toc-enabled
to describe it better.

Bug: T310527
Change-Id: I17e7e6f7f553b8c06b118b5419c98c78ef26ad60
2022-09-28 12:26:38 -07:00
Jon Robson b452a85fe8 Remove VectorLanguage A/B test code (WgVectorLanguageInHeaderTreatmentABTest)
The removal here is actually relatively straightforward.
References inside OverridableConfigRequirementTest are kept as
the A/B test capability remains after this removal and the tests
here do not relate to the code removed, just examples of how it
can be used.

Bug: T302027
Change-Id: I2dd92adaff1221d8213723e9ee60aa02787d4cc7
2022-09-23 18:18:15 +00:00
Jon Robson c1e923f120 Icons: Enable feature flag for next set of visual enhancements
Change-Id: I10f5a2ee8fa8121f8e9a5a79c98db492fbec6534
2022-09-02 07:54:13 -07:00
Clare Ming eb597645c3 Refactor TOC A/B test to bucket users on backend
- Include temporary feature requirement for TOC A/B test.
  - Assumes 100% of logged-in users with even/odd user ids
  being assigned to treatment/control buckets respectively.
  - Sampling rates passed in by config are not considered
  during bucketing.
- Update hook for adding needed TOC A/B test body classes.
- Add test for temp feature.

Note: the temporary feature requirement and associated hooks
should be removed once the 2nd TOC A/B test concludes.

Bug: T313435
Change-Id: If9c75235614af289cd50182baab29bec3155eb81
2022-08-08 15:50:28 -06:00
bwang ef2b0a2372 Remove vector-layout-legacy styles and grid feature flag
Bug: T313559
Change-Id: I050d0e243186ba4341accc26f8d644f55ff995b7
2022-08-08 08:22:26 +00:00
Clare Ming 28732cf4f7 Remove Table of Contents feature flag
- Update related selectors, styles.
- Remove unneeded styles.
- Remove link hijack js.
- Simplify hook to only add experiment name to body.

Bug: T310527
Change-Id: I25527261d529a16e28f1b90f2f5af234d26fd40f
2022-07-21 12:41:39 -06:00
Jon Robson 33a6fb6028 Layout: Title should always be above tabs
**UI CHANGES**
- This change will result in expected UI changes so will flag problems
with Pixel.
- Before merging please confirm Pixel reports 31 passed, 47 failed
- After merging, we should update LocalSettings.php to reset these
changes.

Bug: T310054
Change-Id: Ib35c6bfa5493f7dc81b63c42e7fedb8f1e47226b
2022-07-06 15:25:42 +00:00
Mo Abualruz e46eef19d0 Normalise PHP namespaces used in Vector
- `MediaWiki\Skins\Vector\Tests` is now the prefix for all tests in the skin
- we followed PSR conventions of following folder structure after the prefix
- Optimize imports/use order
- update namespace in skin.json

Bug: T303102
Change-Id: Ib76374d81d973c83adfd6c8e7863ff6d797e655d
2022-05-23 09:32:40 +02:00
Jon Robson d74890df63 [Grid preparation] Add feature flag for grid
Additional changes:
* Make the query string parameter optional and if not defined set it
to lowercase configuration name. I think this makes it more predictable
as some configuration flags are prefixed with vector and some without.

This has the following consequences:
languageinheader => vectorlanguageinheader
languageinmainpageheader => vectorlanguageinmainpageheader
languagealertinsidebar => vectorlanguagealertinsidebar
titleabovetabs => vectortitleabovetabs

Note since table of contents query string is used in the A/B test
I've kept that as tableofcontents for now.

Bug: T303484
Change-Id: Iaca026ef5f32836098dc3b6f0f18632fe84fa8d0
2022-05-13 15:21:52 +00:00
Jan Drewniak 29d938b0f9 Create feature flag for VectorTitleAboveTabs feature
Adds a feature called VectorTitleAboveTabs that will be used to
toggle a forthcoming feature that moves the page title above the
tabs (the ones that link to talk/history etc).

Bug: T303549
Change-Id: Ibadb4293eca16a83e5e7a9f90ddcf51fab0a0e41
2022-05-10 12:53:31 -04:00
Func b61a92f052 Drop the Vector.Config service
It didn't vary by the skin version as documented in the Constants class,
and merely another instance of GlobalVarConfig.

Change-Id: I0acd0366a241e04bb79f6aae5dc52284dfa578df
2022-04-07 04:30:20 +00:00
Jon Robson eca9fcbf79 Drop the LatestSkinVersionRequirement
The LatestSkinVersionRequirement is problematic for various reasons:

1) It uses the "useskin" query string
parameter which may or may not refer to the correct
skin (in the case of a non-existent skin it will always come to the conclusion that
it is not modern Vector and thus must be legacy).

2) It uses the User object which may or may not be safeToLoad
depending on when called.

The feature seems redundant at this point, as we are separating code
into separate classes Vector and Vector22 and all the features only apply
to modern Vector. I suggest we remove it and use the features explicitly in the skin
intended.

Bug: T305232
Bug: T305262
Bug: T302627
Change-Id: I92fa33547bd601e05ddc8c1468e681892e47c16b
2022-04-04 19:22:38 +00:00
Jon Robson b109e10cf3 End migration mode
Can be merged when database rows have been updated to
no longer use skin version.

* Drop migration code
* Drop skin version preference
* Drop default skin version and existing accounts skin version
* Move skin definitions into skin.json
* Repurpose SkinVector as an abstract class
* Update READMEs

Bug: T301930
Bug: T294995
Bug: T302627
Change-Id: I7454d8f1cfdef81e7f3df476d8ce86736b46fff2
2022-03-23 16:46:42 +00:00
jdlrobson d8382ec96b Drop search related feature flags
Given Wikidata is the only project using modern Vector,
and the only project where the search API is not applicable,
this will result in a loss of autocomplete on Wikidata.org
which will fall back to the non-JS mode.

Bug: T290688
Change-Id: Iece5a4efd43e09cd90c842c9c134ca115b35f2b2
2022-01-31 21:00:22 +00:00
Jon Robson 1149d3d611 Drop watchlist in user menu feature flag
Working correctly. No longer needed.

Additional change:
* add tooltip to menu

Depends-On: I418ce75bda8015520d1f1742ddcdfefbc8b9a162
Bug: T289619
Change-Id: I42f21ca8836e5042d07102e1516ca386478dfabc
2022-01-19 16:10:32 +00:00
jdlrobson 7d2d50873f Vector is split into 2 skins
A new vector-2022 skin is added. This will be the eventual home
of the new Vector skin when we are ready to migrate.

Please see SkinVector class for the migration plan to simulate this
as part of testing.

Bug: T291098
Change-Id: Ibaddf94a5bfb5e21bbbaf1e0aa1b343a3f566d2d
2022-01-06 15:52:10 -08:00