Commit graph

251 commits

Author SHA1 Message Date
Sam Smith f87807e457 Limit the number of pages to 3
Bug: T116810
Change-Id: I175a1fd26d2041e3c652c80653a73b4211b992e6
2015-11-13 12:01:35 +00:00
Translation updater bot 0f554baa6e Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-12 22:04:36 +00:00
Translation updater bot df530e471e Localisation updates from https://translatewiki.net.
Change-Id: Ie4dd3af0f529592595eadae54f0640fc4ef424f6
2015-11-12 23:00:40 +01:00
jenkins-bot b83e1bdc58 Merge "Optionally disable Read More using extension data" into dev 2015-11-12 15:55:01 +00:00
jenkins-bot 6a0a130a8d Merge "Remove CustomData extension dependency" into dev 2015-11-12 12:51:05 +00: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
Translation updater bot 95792e7aa8 Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-11 20:59:37 +00:00
Translation updater bot 9092fac5f8 Localisation updates from https://translatewiki.net.
Change-Id: Ibe96646e5b55f1940e7bfcc32477fc12bcd059c5
2015-11-11 21:55:38 +01:00
Translation updater bot 371998e22e Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-10 21:36:58 +00:00
Translation updater bot 602f7d4835 Localisation updates from https://translatewiki.net.
Change-Id: Ib4798cc237bddedf9f7450fac332131bbdfa1485
2015-11-10 22:35:55 +01:00
Timo Tijhof 529b798198 build: Simplify Grunt configuration
* Remove file pattern whitelist for JSHint and JSCS. Instead,
  use the ignore list (which we need to specify anyway to avoid
  errors when using IDE plugins and/or running these from the
  command-line directly.

* Remove redundant '*.json' pattern for banana. '**/*.json' covers
  this already as '**' is recursive from the current directory,
  otherwise it would be '*/**'.

* Remove redundant 'name' and 'version' property. These were likely
  added to suppress warnings by npm-install. However those warnings
  are intended for packages published to npmjs.org. For local build
  tools, adding private:true also suppress these warnings. For
  extensions, name and versions are already maintained in other files
  such as extension.json and others.

* Remove redundant '$' entry in jshintrc. There's no need to tolerate
  use of global variable '$'. The convention is to use 'jQuery' and
  alias it locally, which this extension already does everywhere.

* Set 'jQuery' to false instead of true in jshint globals. True
  means it allows and expects this package to assign or expose
  the 'jQuery' identifier. However that is not the case. If this
  code overwrites jQuery, that should probably trigger a warning,
  thus set to false, which means read-only global.

Change-Id: I0b159b6d684f67933e0dae506db1eb3800a6f192
2015-11-10 18:07:15 +00:00
Sam Smith 239705928d Remove CustomData extension dependency
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
2015-11-10 17:03:06 +00:00
jenkins-bot 35193ffc66 Merge "Add event logging to read more" into dev 2015-11-10 12:35:19 +00:00
Baha 3995b7a8ef Add event logging to read more
* Schema is located at https://meta.wikimedia.org/wiki/Schema:RelatedArticles.
* Track 'ready', 'seen', and 'clicked' events.
* The sampling rate can be set using the RelatedArticlesLoggingSamplingRate variable.
  If the variable is not set, sampling will be disabled. The default sampling rate
  is 0.01.
* Events are tracked using a unique user session token.

Dependency: Iea00d534371353c3ae5c06c74a08aa10cb60047b
Bug: T114303
Change-Id: I649d0817cbd10ad734989da548d20ad33e7f7360
2015-11-10 15:23:12 +05:00
Translation updater bot 356bdf5206 Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-09 20:52:06 +00:00
Translation updater bot e581445e04 Localisation updates from https://translatewiki.net.
Change-Id: Ia6d29a76da1d805e9f925fd4f53c00e7073416a4
2015-11-09 21:47:55 +01:00
Translation updater bot 631814bfb5 Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-08 21:15:35 +00:00
Translation updater bot 348ac6440a Localisation updates from https://translatewiki.net.
Change-Id: I6dfc6d79e32ffd4aad190dcd2bf5b114bd769651
2015-11-08 22:12:39 +01:00
Translation updater bot 8c235cdad0 Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-07 21:46:41 +00:00
Translation updater bot bdd267f6ba Localisation updates from https://translatewiki.net.
Change-Id: Ide171261caeefea32365927c2a326d43b6cbf909
2015-11-07 22:44:39 +01:00
Sam Smith 7ebe784fc2 Run JSHint and JSCS against tests
Changes:

* Extend the definition of all JavaScript files to include those in the
  tests directory
* Run JSHint and JSCS against all JavaScript files
* Fix the existing code style errors in the RelatedPagesGateway
  test

Change-Id: Ia6d8fa63e0b86760857d4480a0575b57512fa36b
2015-11-06 22:08:31 +00:00
jenkins-bot d09d128976 Merge "Put Read More behind a feature flag" into dev 2015-11-06 22:00:54 +00:00
Translation updater bot 2f08387830 Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-06 21:30:28 +00:00
Translation updater bot deb6c8c6b7 Localisation updates from https://translatewiki.net.
Change-Id: I5475324a8181024f40c885b876594b8c3ecd741a
2015-11-06 22:27:29 +01:00
Sam Smith 5b5a0b288f Put Read More behind a feature flag
Changes:
* Add the RelatedArticlesShowReadMore feature flag, which is disabled by
  default
* Only consider adding the Read More bootstrap module to the output when
  the feature is enabled

Change-Id: I60fc38115257c9a5dbf04b51dbec7f091574d8f6
2015-11-06 20:12:27 +00:00
jenkins-bot 208cb50d33 Merge "Fall back to CirrusSearch's morelike: feature" into dev 2015-11-06 18:48:03 +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
Translation updater bot 44ef79949c Merge "Localisation updates from https://translatewiki.net." into dev 2015-11-05 20:48:13 +00:00
Translation updater bot 8ce9069106 Localisation updates from https://translatewiki.net.
Change-Id: I662b0c585a40492fc2750c5fb3df0b5155412a8f
2015-11-05 21:45:04 +01:00
Translation updater bot b7a579ca64 Localisation updates from https://translatewiki.net.
Change-Id: I9f3f17f8d99ddfc254465b9246ac6da0723d588f
2015-11-04 21:22:00 +01:00
jdlrobson 8f191de636 Release version 1.1.0
* Switch default branch to dev for future development

Bug: T117612
Change-Id: I404e412330f9416b863012b5125cbf4fc6d2b4ce
2015-11-04 15:08:10 +05:00
Translation updater bot 5e7dc73beb Localisation updates from https://translatewiki.net.
Change-Id: I21826b4e743666f17c61c67a7cc2ae57b909817c
2015-11-02 22:38:30 +01:00
Sam Smith 816003cb48 Tweak readMore.minerva to reflect upstream changes
As of I6a5b43a, WatchstarPageList requires that options.api be an
instance of mw.Api and fails, loudly, when it isn't passed.

Bug: T117467
Change-Id: I7394dea5ab026de1a6709c56d8db4ff72788b59d
2015-11-02 20:04:37 +00:00
Translation updater bot 697bd7dfec Localisation updates from https://translatewiki.net.
Change-Id: I55aa87bb257db68b52e7e4ba46ddb3c0fb71a4ca
2015-11-01 21:40:47 +01:00
jdlrobson e4685f02be mw.config.get doesn't work that way.
You can't give it a fallback value. This is causing JS errors in
production.

Bug: T116758
Change-Id: Ia459a42250ca6e030025781005e40204f1ede58e
2015-10-29 13:57:50 -07:00
Translation updater bot 72a06e4840 Localisation updates from https://translatewiki.net.
Change-Id: If5b9b60a89b2628661ef2d38bbedad31dcea0b5b
2015-10-29 21:25:53 +01:00
Translation updater bot 87e6fdaf47 Localisation updates from https://translatewiki.net.
Change-Id: I25f06c05cf0b3f89f9b21354d58fcc92c876320d
2015-10-28 21:55:24 +01:00
Translation updater bot 4e8dae3874 Localisation updates from https://translatewiki.net.
Change-Id: I1a1ca6fbaffbbe852640a82a66c6465bbff9fd52
2015-10-27 21:33:19 +01:00
Sam Smith 7c23636954 Add Related Articles section to Minerva
If the page has related articles, is in mainspace, isn't the main page,
and the output is being rendered with the MinervaBeta skin then a
"Related Articles" section is added to the page just before the footer.

Separate loading the information necessary to render the pages, choosing
the renderer, and rendering the data so that multiple skins - currently
Minerva and Vector per the mocks - not just multiple resolutions can all
be handled the same way:

* The bootstrap script (ext.relatedArticles.readMore.bootstrap/index.js)
  for fetches the page image and Wikidata description; loading the
  renderer module; and, finally, notifying the renderer module that it
  should render the data, which it does by emitting
  "ext.relatedArticles.readMore.init" event using mw#track
* The Minerva renderer subscribes to the event and, when it's fired,
  renders the data by passing it to the WatchstarPageList view

Bug: T113635
Change-Id: I651342bdf9796938fa7051828dd13bc6fe774783
2015-10-26 17:13:46 -07:00
Kunal Mehta 81fcc48fa9 build: Updating development dependencies
* mediawiki/mediawiki-codesniffer: 0.4.0 → 0.5.0

Change-Id: I92d28f0712b0a3447cc1dd0e2a8eac36e3a9916a
2015-10-23 15:32:25 -07: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
Sam Smith 45787910d3 Hygiene: Fix PHPCS errors
Also, add more detail to the
RelatedArticles\Hooks::onOutputPageParserOutput DocBlock.

Change-Id: I484ebfe255bc07a11d84f518014c8cc4f73f62db
2015-10-14 11:31:50 +01:00
Siebrand Mazeland 397146eab8 Update indentation to use tabs
Change-Id: Iaa7970fc03ef2182d8fbd68fb0ed8dabd2615e12
2015-10-13 08:45:44 +02:00
Kunal Mehta 1ab33e4886 build: Updating development dependencies
* grunt-banana-checker: 0.2.2 → 0.4.0

Change-Id: I94a118adc53612636eb362cd47da16049f9f4caf
2015-10-11 11:57:09 -04:00
jdlrobson 8782824cfc Remove CustomData dependency
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
2015-10-08 15:57:44 -07:00
Sam Smith 7995ce4a42 Use extension registration
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
2015-10-07 15:54:07 +01:00
Sam Smith cd055fde89 Add extension boilerplate
Copypasta the following files from the BoilerPlate extension [0]:

* package.json
* Gruntfile.js
* .jscsrc
* .jshintrc
* .jshintignore
* composer.json
* phpcs.xml

Add the following supporting files:

* .gitignore
* composer.lock

Finally, fix the existing coding standard violations.

[0] https://github.com/wikimedia/mediawiki-extensions-BoilerPlate

Change-Id: I30c6cf9e0a637bab5d8f47790b9af57183b6e6fb
2015-10-07 15:48:26 +01:00
Kunal Mehta 426422bc96 build: Configure banana-checker and jsonlint
Change-Id: I7d0f6571baf2eef4948db8faea4a97bae0246641
2015-06-19 22:13:04 -07:00
Translation updater bot 43865c8c22 Localisation updates from https://translatewiki.net.
Change-Id: I917d83e3486eba395ddcdac13b7446556dfd5a64
2015-03-23 22:05:14 +01:00
Translation updater bot f62a0835a0 Localisation updates from https://translatewiki.net.
Change-Id: I13fcdd8501b17e773682e6671b429a4dfa26ae14
2015-03-10 22:36:09 +01:00