Commit graph

85 commits

Author SHA1 Message Date
Umherirrender 63ced7322b Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: I49107af15dcfd8264ebe49fe540402d44a4cd6a4
2024-06-10 20:16:42 +02:00
jenkins-bot 886606fdc5 Merge "Drop MobileDiff check" 2024-04-09 15:57:21 +00:00
Jon Robson b219d6fb5d Drop MobileDiff check
This page is now just a redirect so the reference is no longer
needed.

Bug: T360389
Change-Id: I216fe95e9ace82fc30879a23ece84b568159a01e
2024-04-03 10:01:24 +08:00
DannyS712 9471c6f7f9 Hooks: injected needed configuration
To avoid needing to use MediaWikiServices

Change-Id: I37bd3b511632e8e82f48806c272aa18953eea42d
2024-02-07 18:24:23 +00:00
DannyS712 bc9added4f Hooks: inject DisambiguatorLookup as an optional service
Follow-up: Id2a10f2f1be0e38ddb8ebef5d5babb3daac3ce9a
Change-Id: Ib1a0297fd17e1cec0847d68a0c184e3c713f0111
2024-02-05 18:23:47 +00:00
C. Scott Ananian 703e142c59 Use service framework to access Disambiguator extension, not hard-coded class
The Hooks::isDisambiguationPage() method is deprecated in any case.

Change-Id: Id2a10f2f1be0e38ddb8ebef5d5babb3daac3ce9a
2024-02-02 15:16:54 -05:00
Umherirrender 97d9d3700b Use namespaced classes
This requires 1.42 for some new names

Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I738fa5cd78d9b662326afc268bc2a90cb1540948
2024-01-05 21:22:56 +01:00
Umherirrender 91915dd6ff 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: Iafd6d3bae30038bac2fad967924a9461aa57761b
2023-10-21 21:58:11 +02:00
Umherirrender c5b6a8018b Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.
Remove optional return from hook handlers

Bug: T346560
Change-Id: I4e42f7cf361e41c3ee687abcf41409a4704b7bf6
2023-09-27 21:02:11 +02:00
Umherirrender 54f5923e32 Simplify Hooks::hasRelatedArticles
- Skin is a IContextSource, same as OutputPage, use the skin directly
- Use WebRequest::getRawVal/getCheck
- Move isDisambiguationPage() down a bit, it needs database queries
- Remove unused argument from ::isReadMoreAllowedOnSkin

Bug: T347123
Change-Id: I1b7cdc8bd330624f0a099284f6eabbb3ad62675a
2023-09-22 22:51:28 +02:00
Umherirrender 5bd33d9855 Use ::class for class name resolution
Change-Id: Ib75278e3728c1cd24e568f9f30f5cb32f19c5622
2023-09-20 20:59:19 +02:00
gerritbot 3f4bd5f8e4 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I36a0ac048f3898512e3ccefdb34c5e2e774f790b
2023-08-19 04:18:57 +00:00
Jon Robson 4d883cf58a Pages that do not exist shouldn't output related articles
Bug: T308078
Change-Id: Ie86ea03e4529e74cc5d9f71c973a5ab738ca499b
2022-05-11 19:13:35 +00:00
jdlrobson 83c2b071c4 Fix loading of related articles via IntersectionObserver
For IntersectionObserver to work the element we listen on needs to
have a non-zero height.

Bug: T223844
Change-Id: I308f646670b112e42b0aaa11c438dbc5cdc5edd8
2021-11-04 12:30:11 -07:00
Reedy cb5b1baecf Use namespaced Disambiguator Hooks class
Change-Id: I1b2e6e4ac6e4612221f1f720356860c16c5aa5ee
2021-10-19 15:58:36 +01:00
Reedy 804debdd8e Remove RelatedArticlesFooterWhitelistedSkins
Bug: T277958
Depends-On: I34519c75bafb56b7f042d7bb95eed49b59bb01a8
Change-Id: Id4391badba750d5acc0d03c8caf0165ba5910741
2021-05-03 23:29:06 +00:00
Reedy 2715c27bbe Rename RelatedArticlesFooterWhitelistedSkins to RelatedArticlesFooterAllowedSkins
Bug: T277958
Change-Id: I468a38df92347cc764e0457d4598bedfc4d92efa
2021-04-20 19:00:26 +01:00
James D. Forrester ac94e7efad Use QUnitTestModule instead of deprecated ResourceLoaderTestModules
Bug: T232875
Change-Id: I5612a9be65f4d4adf4912645856540dbb04d2b34
2020-05-11 19:53:57 +00:00
Umherirrender 1fa6409ebe Improve param docs
Change-Id: I8debd7a907b8be61f9e6595e461d40fbd1352f63
2020-02-29 22:38:00 +01:00
libraryupgrader dfb3995a90 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 28.0.0 → 29.0.0
  The following sniffs are failing and were disabled:
  * MediaWiki.Commenting.FunctionComment.MissingParamTag

npm:
* eslint-config-wikimedia: 0.11.0 → 0.15.0
  The following rules are failing and were disabled:
  * no-jquery/no-parse-html-literal

* grunt-eslint: 21.0.0 → 22.0.0
* grunt-stylelint: 0.10.1 → 0.13.0
* stylelint-config-wikimedia: 0.6.0 → 0.8.0

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.
* Removing manual reportUnusedDisableDirectives for eslint.

Change-Id: Iab538420d73bbbebfd05cf815ab06773f16da8da
2020-01-15 06:11:54 +00:00
Max Semenik bc24e8a71d Stop passing objects by reference
Bug: T193950
Change-Id: I36dc8a0f887bf11275f9cf3611651ca1091cd9f7
2019-11-14 22:17:56 -08:00
Isarra b31970084f Use SkinAfterContent hook to place cards in the DOM
This allows skins to determine where the cards appear in a consistent
fashion with other extensions, and require minimal special handling from
the extension itself.

Also change default settings as to when RelatedArticle cards will appear
- keep the whitelist to allow projects to configure their usage such as
in the case of only wanting it on mobile, etc, but now that it should
just work in any given skin, default it to on for all so that it's easier
for the average third party to install for whatever use.

Note that this default setting change will not affect WMF wikis, as
wmgRelatedArticlesFooterWhitelistedSkins is explicitly set in the
wmf-config regardless.

Bug: T181242
Depends-On: I5b0ad889e633fde88c392577ce5373c81fc5486a
Change-Id: Iebd759c0d1a536768d18953f372664df762d9e04
2019-07-26 19:28:49 +00:00
Timo Tijhof 8becbc2b23 Omit 'wgRelatedArticles' from page view HTML when empty
* The extension already uses 'null' as placeholder in RelatedArticles
  instead of empty array. Update the doc comment in RelatedPagesGateway
  to reflect this (its code was already using the default operator
  to fallback to empty array, given empty arrays are not falsey in JS,
  but null is).

* Omit the key from the mw.config output in <head> on page views,
  when the value is null, given this is redundant information and consumes
  additional space.

Bug: T219342
Change-Id: I367f9d9423d66611d73d56f8a769d86d14d3de8b
2019-05-26 13:49:16 +01:00
Timo Tijhof 6a0d64d3f0 Remove 'wgRelatedArticles*CirrusSearch' from page view HTML
Bundle these with the module that needs it instead, this means
1. It is naturally only downloaded on pages where it is needed.
2. It doesn't block download/parse/render of the article HTML.
3. It doesn't delay time to mw.loader.load() for interactive
   functionality.

Bug: T219342
Change-Id: I5c6809392b0621bd0d58049597f6c0306e572607
2019-05-25 22:04:51 +00:00
jdlrobson fcfa09184d Remove unused ResourceLoaderMuHoganModule module
Followup from 191fc2a

Bug: T219846
Change-Id: Id5abee14f897204f072420cec2d6fdcf40cd37ff
2019-05-01 11:00:12 -07:00
Kunal Mehta 3b7728f7cf Avoid use of func_get_args()
Change-Id: I7e0fb290be734dcbec39be9bcb9f17551e785de6
2019-03-09 18:36:30 -08:00
jdlrobson 6b49ddff1b Remove EventLogging/A-B test code from RelatedArticles
With RelatedArticlesEnabledBucketSize now removed, installation of this
extension will turn it on for 100% users without any mechanism to turn
it off.

Additional changes:
* Bump version
* Add Readers team to contributors

Bug: T202306
Change-Id: I7dc270a06dd3afd4e894c8298165d6d6d4fda8d6
2018-09-20 11:13:13 -07:00
Jan Drewniak 6856ef8b5e Renaming QUnit test files from "test_" to "test.js"
Updates QUnit test files from starting with "test_" to ending with
"test.js" in accordance with the Readers Wed coding conventions.

https://www.mediawiki.org/wiki/Reading/Web/Coding_conventions

Bug: T197884
Change-Id: I3c15385d22d308b8b465985ca55e8b802d72dae4
2018-09-19 14:54:48 +02:00
Timo Tijhof f6c23000f2 Remove use of deprecated 'ext.eventLogging.Schema' module
This is the last remaining use of the module name "ext.eventLogging.Schema"
in Wikimedia Git. It is an alias for "ext.eventLogging.subscriber".

Change-Id: Idf295ef9c550ad7f1a19ac0b84e856d606ab8eb3
2018-08-06 17:40:05 +02:00
Kunal Mehta 0837f19dcd Register EventLogging schema in extension.json
Change-Id: I4079f13a6708ad4376b7686c3926cd59ff90aaa7
2018-06-11 18:30:22 -07:00
Umherirrender 72bf976e12 Rename file ResourceLoaderMuhoganModule.php to match class
Change-Id: Ibdabb503fbbe6c17f041943cae8fa6ee4dbdfe20
2017-12-09 23:15:30 +01:00
jdlrobson bd860b29a3 mediawiki.experiments is a dependency of RelatedArticles
Avoid potential race conditions.

Bug: T175064
Change-Id: Ic7eaea8181ce6eb64b4bce571182644105667a5b
2017-09-05 15:54:50 -04:00
jdlrobson ab788e7f41 Merge footer hooks with Hooks
per Baha's suggestion we have no need for two Hooks files now
so let's merge them

Bug: T165991
Change-Id: I12c62aef837f50589297477f46bdf0f0d6b5536a
2017-08-10 15:10:30 -05:00
jenkins-bot 70787d2d70 Merge "Breaking change: Remove Sidebar code from RelatedArticles" 2017-08-10 18:26:08 +00:00
jdlrobson 94ecc2d917 Breaking change: Remove Sidebar code from RelatedArticles
RelatedArticles will now only render related articles in the footer of
skins.

Bump version to 3.0.0

Bug: T165991
Change-Id: Ia4e28c0ed76b3aff37c0aea8eb713923312ba23c
2017-08-10 12:44:58 -05:00
Umherirrender 9a83d49ea0 Fix typo in word parser
Change-Id: I01f950621fda1388e1f8fcc79f217d1f639ac357
2017-07-28 17:44:09 +02:00
Umherirrender 548392824d build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: Ie05b9ddc3e351abf4b2b199529b714766055d161
2017-07-26 22:59:51 +02:00
Piotr Miazga 88c7a705e2 Restore default MediaWiki codesniffer configuration
Changes:
 - re-enabled all sniffs
 - fixed code to meet MW code standards

Bug: T170589
Depends-On: Ib7f0bd15dd0a9255e1e5140907e800478b658b92
Change-Id: Idb08a3e105226877804a84b120c70e5defa7398c
2017-07-25 02:46:46 +00:00
jdlrobson f748c5907e Add limit via ResourceLoaderGetConfigVars
Using MakeGlobalVariablesScript hook will add config variables to
the HTML meaning cached HTML will not be able to access it leaving
it as undefined. This will mess up any existing caching.

Additional changes:
Because I'm paranoid, make sure that value is never undefined.

Bug: T170648
Change-Id: Icb8e34104c57b1e69b7e035ef89d5b4c3371132f
2017-07-14 16:42:53 -07:00
jenkins-bot 38ac4650e0 Merge "Make number of RelatedArticles configurable" 2017-07-06 21:09:06 +00:00
jdlrobson 9126c7d0ef Make number of RelatedArticles configurable
Wikivoyage pages have more than 3 related articles as they make use
of the {{#related:}}  magic word.

After speaking with Nirzar we should allow this project to show more than 3.
This change allows this while keeping the existing behaviour on other wikis and
will pave the way for removing a bunch of code from this extension.

Additional changes:
* Cleanup skinStyles definitions
* Limit cards to 30% maximum width and give margin top to account for
situations where the number of cards are multiple of 3
** In Minerva hardcode the max-width to pixels.
* Margins are switched from hardcoded 10px to percentage based. Yes
this changes the right margin slightly but is more maintable and visually
the same.

Bug: T164765
Change-Id: I41119de3228c2df799f740d4bd00082101c21b97
2017-07-06 11:17:47 -07:00
jenkins-bot 750f3d73fd Merge "Hygiene: SamplingRate -> BucketSize" 2017-06-22 18:40:08 +00:00
Kunal Mehta 87b7254eaf build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.FunctionComment.Missing.Public

Change-Id: I591fd0cd60147b9f5ddd3d1b9e74f79a0bb3f595
2017-06-20 00:20:19 -07:00
Sam Smith f4c82d3a33 Hygiene: SamplingRate -> BucketSize
In order to avoid further confusion, clarify that we're bucketing users
for experiments.

Bug: T167236
Depends-On: I752cdf068ca25bffb38229380785e7da1a208049
Change-Id: I6508ab8fa3d436ae295eb047e170fdc5417d25fc
2017-06-20 05:26:29 +01:00
jdlrobson 4598d9b567 Remove CardsGateway (unused)
Bug: T167647
Change-Id: I7e2a7777a5f28991d77deab520a55d3bd242104b
2017-06-14 13:10:01 -07:00
jdlrobson 6dee0147f4 Migrate Cards code to RelatedArticles
* Move across all files
* Rename ext-card- prefix to ext-related-articles- prefix
** Since all code using these prefixes is JS
  we do not have to worry about cached HTML

Bug: T137021
Change-Id: I784fd132c36329fa0dcc49fe2804460061940347
2017-06-07 08:35:53 -07:00
jdlrobson dbb73c389d Remove Related Articles from desktop beta features
This change removes RelatedArticles from beta features.
It repurposes the BlacklistSkins config to be a whitelist that describes
when related pages should be shown in the footer.

To avoid enabling related pages on desktop, this depends on a config
change that makes use of the new configuration option.

Simplify browser tests to reflect the new status quo.

Bug: T146436
Bug: T160076
Depends-On: I522e0182d1c3d9261bd0561c3ec0c789b6431c7a
Change-Id: I84da1fb33a901a6365375d00d192af35422ff0b0
2017-04-04 23:01:36 +00:00
Baha 26e4e8d1fd Schema:RelatedArticles revision update
Log the `feature-enabled` event for users who are eligible to see the
ReadMore feature. Otherwise log the 'feature-disabled' event.

Suporting changes:
* Register the latest version of the RelatedArticles schema.

Bug: T157375
Change-Id: I1557de88c7602aa066833bd55b83e6ee51d27178
2017-03-06 10:48:35 +00:00
Baha a40286c800 Hygiene: lazy-load event logging code
This allows us to decouple the event logging code from the
`ext.relatedArticles.readMore' module. As a result we'll be able to
log events without loading the above mentioned module.

Bug: T157375
Change-Id: I55cf4f40cafc88d6baeb5cc1b41fc2d6bcd2fbb9
2017-03-01 14:45:32 -05:00
jdlrobson 36dfaccd2f Always show RelatedArticles to users who opted into beta feature
Additional change:
* Correct how we expose RelatedArticlesEnabledSamplingRate so that
it includes the wg prefix and is consistent with other config values

Bug: T157372
Change-Id: I274de542cf461de60f903ddbc0353a4116016007
2017-02-07 16:05:26 -08:00