This simplifies the codebase by avoiding some unnecesary custom hooks,
and also improves Parsoid compatibility.
We look for old extensiondata coming from cached pages for
compatibility, but that code can be removed once the ParserCache expires
(T371421) for further simplification.
Bug: T263772
Change-Id: I843a920a0476290a8b0efd5eba4d8d44777d27d0
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
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
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
- 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
For IntersectionObserver to work the element we listen on needs to
have a non-zero height.
Bug: T223844
Change-Id: I308f646670b112e42b0aaa11c438dbc5cdc5edd8
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
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
* 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
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
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
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
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
* 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
Changes:
- use MediaWikiServices::getConfigFactory() instead of depreacted func
- fix wrong param type for ResourceLoader
Change-Id: Id983f3cc57a4d1d23ef8dd0a52e78320dd51e9ca
The ParserOutput object is already reset when state is reset, so there's no
point in setting or unsetting properties on it.
And since the only unit test was deleted, remove the hook for that too.
Change-Id: Idf12365e8c4b14e527d923edc1086bdaf349df32
There are two positions where the list of related articles is rendered:
the sidebar, and the the footer. Move the hook handlers related to
rendering the former to RelatedArticles\SidebarHooks and those related
to rendering the latter to RelatedArticles\FooterHooks.
Change-Id: Idde57905d828e63309bfdc360a3a09e64e291304
When $wgRelatedArticlesShowReadMore was false, while deciding
whether to show related articles on the sidebar,
we used to incorrectly consider whether BetaFeatures was
enabled for the user. BetaFeatures should only be used
for enabling ReadMore and not for showing related articles
on the sidebar.
We also used to show the beta features option for ReadMore
even when the ReadMore feature was disabled. Now we only
show that option if ReadMore is enabled.
Also rename isAbleToShowRelatedPages to isInSidebar to make
the function less confusing.
Bug: T119926
Change-Id: Ia5e44d94bb20660af711772cab7e3a59f98c931f
Hide the related articles from the sidebar if ReadMore is enabled.
Otherwise leave as is because it's used in WikiVoyage.
Bug: T117444
Change-Id: I3879ae1e53de301b0d3f5f2c066f8e8de7c1c223
Leave all public-facing uses of "article" (including classes) because
the extension is remaining named RelatedArticles. Replace all other
instances with "page" for consistency with other extensions.
Bug: T117908
Change-Id: Ib0f258f26b0d11cfe8a598dbd90ff37afbbe36ac
The related pages stored via CustomData will have been migrated to the
cached ParserOutput class over the last 30 days, per I30bd17f, so all
interactions with/references to CustomData can be removed.
Bug: T115019
Change-Id: I36919d2443f0ee02ac6baf9a4d2228b028b2e6ed
While the related parser function sets the accumulated related pages as
extension data on the parser output
(see RelatedArticles\Hooks::onFuncRelated). The ParserClearState
handler, however, sets the empty list as a property, which is then
stored in the DB.
Changes:
* Make RelatedArticles\Hooks::onParserClearState use
ParserOutput#setExtensionData, mirroring ::onFuncRelated
* Add a unit test for the the handler
Bug: T115698
Change-Id: I3deaf1e8ee78944250c3f26315ee2450b444a035
Since CustomData was written ParserOutput now supports the setting
and getting of properties. This patch switches RelatedArticles to use
that. I'm not sure if any other extensions depend on CustomData but
it seems to have served its purpose.
Bug: T114915
Change-Id: I30bd17fd8c43422fe7ab6f58a74565674e15ba1d
Add extension.json and populate it with information from both
RelatedArticles.php and the RelatedArticles extension wiki page [0].
Migrate the hook handlers to static functions operating on static data
rather than having a single, global instance of RelatedArticles so that
the hook handler definitions can be added to extension.json easily.
N.B. During testing the handlers for both the SkinBuildSidebar and
SkinTemplateToolboxEnd appeared to have the same effect so the TODO was
removed but not the handler for the former.
Additional changes include:
* RelatedArticles.class.php -> includes/RelatedArticles.php
* RelatedArticles -> RelatedArticles\Hooks
* Documenting all of the methods of RelatedArticles\Hooks
[0] https://www.mediawiki.org/wiki/Extension:RelatedArticles
Bug: T87965
Change-Id: I9944b9186746386ee18ca28657bb547c00ae2b8c