Commit graph

10 commits

Author SHA1 Message Date
Antoine Musso d8b773f9a4 Rake entry point and rubocop fix up
Introduce the rake test entry point which is invoked by CI.

Add a basic rubocop configuration based on
https://www.mediawiki.org/wiki/Manual:Coding_conventions/Ruby

Fix up a few ruby issues.

Bug: T120715
Change-Id: I3df0a3b13155259ec6cb5010e7aaa3bf9aa7b230
2016-01-06 16:57:22 +01:00
Baha f19aee12b8 Add Gemfile
mediawiki_selenium 1.4 or greater is need for running browser tests.

Bug: T120715
Change-Id: If5bf9dcc7310896b8d8b218d636952c344a2a105
2015-12-28 15:54:25 +01:00
jdlrobson 1db93f0d14 QA: Add extension tags to tests
Certain tests only work when certain tests are installed. Tag them

Bug: T120715
Change-Id: I6b4333e5c45c41fc5699bf18f6b3a76556290df6
2015-12-07 20:27:25 +00:00
Baha 9932fee563 Add browser tests for ReadMore
Change-Id: Ia1f628b4f2e1af7d33dc6779a139c2800be82964
2015-12-04 15:43:45 +05:00
Sam Smith fbc696177a Fix RelatedPagesGateway unit test failures
I33936a3 didn't introduce a regression but highlighted an issue with the
fixture in the RelatedPagesGateway unit test: the fixture is in the
legacy JSON format despite the API request URL including
formatversion=2.

Change-Id: Id372d022625d88eea685267ea6b6484cf6b28cbc
2015-11-25 14:34:11 +00:00
Baha 8cf9b60ab5 Make RelatedArticles soft-depend on Cards
RelatedArticles tries to load the 'ext.cards' module and if
it succeeds it continues with showing the related articles
on the page.

Dependency: I6661527175eb889cec4193b18fa18207f332b4fc
Bug: T117108
Change-Id: I33936a3e9cd5d1f0296e48fd1c2bba77fff4e466
2015-11-18 22:22:10 +05:00
jhobs d08962d12d [Hygiene] Rename internal uses of "article" to "page"
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
2015-11-13 19:03:39 -05:00
Sam Smith 0fed50e266 Optionally disable Read More using extension data
By default, the Read More feature tries to use editor-curated articles
before using the CirrusSearch morelike: feature. Add a configuration
variable that disables the former behaviour but leave the default in
place.

Changes:

* Add the wgReadMoreOnlyUseCirrusSearch configuration variable, which
  defaults to false, and pass it in to
  mw.relatedArticles.RelatedPagesGateway at construction time
* Add the onlyUseCirrusSearch parameter to
  mw.relatedArticles.RelatedPagesGateway, which controls whether to
  ignore the editorCuratedArticles parameter

Bug: T117443
Change-Id: I0dfa67f4a68e8dc17302fef7ebf8d23c0c1d892c
2015-11-12 12:43:29 +00:00
jdlrobson e86fc3b159 Fall back to CirrusSearch's morelike: feature
When no related articles have been specified by an editor we instead
hit request pages similar to the current page using the CirrusSearch
extension's "morelike:" feature [0].

Changes:
* Config variable introduced RelatedArticlesUseCirrusSearch which allows
you to turn on use of the CirrusSearch API.
* Introduce a RelatedPagesGateway for dealing with making the API call
  and returning consistent results
* Move the "simple" API call for hydrating related pages fetched from
  the wgRelatedArticles configuration variable into RelatedPagesGateway
* Reduce the bootstrap module to just a bootstrap module!

Bug: T116707
Change-Id: Ia0ced1d7ae57c0939d1f5af275aa9d393f1420b1
2015-11-06 10:23:39 -08:00
Sam Smith aa30f477bd Clear extension data in ParserClearState handler
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
2015-10-16 20:33:52 +01:00