Commit graph

1520 commits

Author SHA1 Message Date
jenkins-bot 22d9ef3e24 Merge "Re-enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment sniff" 2017-07-13 17:42:21 +00:00
Piotr Miazga 75ef7c4f93 Re-enable MediaWiki.Commenting.FunctionComment.MissingReturn sniff
Bug: T168384
Change-Id: I8d7b750503ca9c951267a948862c3685ea036100
2017-07-13 15:47:00 +02:00
Piotr Miazga 5b62bc625b Re-enable MediaWiki.Commenting.FunctionComment.MissingParamTag sniff
Changes also solve the MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
sniff

Bug: T168384
Change-Id: Idd80e42943a57a4b6211c50a4aac2f1d20e6232d
2017-07-13 10:43:00 +00:00
Piotr Miazga b8e7a79a20 Re-enable MediaWiki.Commenting.FunctionComment.MissingParamComment sniff
Bug: T168384
Change-Id: I8b29f0ec6804e24ea4d61fb1bf1a528dddaf8fb8
2017-07-13 11:33:04 +01:00
Piotr Miazga 18b6675b4a Re-enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment sniff
Bug: T168384
Change-Id: Id64269f5950d6da5fee3f18825ce2d713d0446b0
2017-07-12 22:44:12 +02:00
jenkins-bot 311466cad0 Merge "Send disabled event when user disables Page Preview" 2017-07-12 14:16:36 +00:00
Piotr Miazga 8bba8c1417 Send disabled event when user disables Page Preview
Changes:
 - introduced new UserPreferencesChangeHandler class that listens to
 PreferencesFormPreSave hook
 - introduced wrapper for EventLogging extension plus NullLogger when
 EventLogging extension is not availalbe
 - when user changes PagePreview to disabled system will trigger
 disabled event

Bug: T167365
Change-Id: I63faecb0495eb30a9fc2763e7ddf3944baf7f55a
2017-07-12 15:59:42 +02:00
Translation updater bot 0fb8f5a65a Localisation updates from https://translatewiki.net.
Change-Id: I61de05da6e1679a12952612b7aba25c7cb59d9e5
2017-07-11 22:58:31 +02:00
Translation updater bot fa04af56c6 Localisation updates from https://translatewiki.net.
Change-Id: I1a6585835a1721ba30f7e23a2f7c634950a268fd
2017-07-08 00:18:40 +02:00
Translation updater bot 83aecd60b7 Localisation updates from https://translatewiki.net.
Change-Id: I40de42b4bb595fff4074f95766cd05e078c24fba
2017-07-06 22:55:34 +02:00
jenkins-bot 59290bcf4a Merge "Remove duplicate events filtering" 2017-07-06 18:05:18 +00:00
jenkins-bot eebd0c5e8b Merge "Send disabled event from settings windows" 2017-07-06 18:05:17 +00:00
Piotr Miazga 426356e822 Remove duplicate events filtering
We had instrumentation for over 4 weeks and duplicate events rate
was very low. We want to keep stats so we check the duplicate events
rate but there is no need to filter those.

Bug: T167365
Change-Id: I72585beb21e9db589e45eeace657ef25f432abc9
2017-07-06 17:38:42 +02:00
Translation updater bot caec0a85b5 Localisation updates from https://translatewiki.net.
Change-Id: I954cca0dba2970339111682f70a6014023a61c27
2017-07-05 22:37:47 +02:00
Translation updater bot ef058cacc4 Localisation updates from https://translatewiki.net.
Change-Id: I5c82f25ce87124ad5d64d7052e77c9b459dbb06e
2017-07-04 22:42:26 +02:00
Piotr Miazga 7e2c79ae0d Send disabled event from settings windows
Changes:
 - introduced new event 'disabled', sent from settings popup
 - added unit tests for 'disabled' event handling

Bug: T167365
Change-Id: I048b38122b8843199c86fd1ed9ec2ff21767e114
2017-07-04 19:08:37 +02:00
Amire80 9df91fd043 Change "article" to "page"
This is the usual practice in MediaWiki extensions,
for consistency among wikis where pages are
not necessarily articles.

Change-Id: I25d8ccb9090c31e4672998c8a01ebdfcaf625e9f
2017-07-04 07:15:44 +03:00
jenkins-bot 6a1176c0d2 Merge "Enforce no top&bottom margins on lists on page previews" 2017-07-03 13:52:28 +00:00
jenkins-bot 4f9ad4d0a7 Merge "Override eventLogging to enabled when debug flag is on" 2017-07-03 11:54:56 +00:00
Kunal Mehta e7ac7f0b7d build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
Change-Id: I5c8aaff0ed7b9eef97db7e22188212e37ee3beb1
2017-07-01 01:40:13 -07:00
Translation updater bot 82ee8e990a Localisation updates from https://translatewiki.net.
Change-Id: If9ba575dec354efce94bb24dc52ad3a9a6d5ad63
2017-06-30 23:34:00 +02:00
Piotr Miazga a82e54bf2d Override eventLogging to enabled when debug flag is on
In order to debug the EventLogging instrumentation in production
environments, we want to be able to bucket ourselves at will.
When the debug flag (?debug=true) is passed send all events
for given page view.

Bug: T168847
Change-Id: Id1b13b0ecaa791b4f26be4d1151bdbbe5270b64d
2017-06-30 18:52:51 +00:00
Piotr Miazga 06ef34c05f Enforce no top&bottom margins on lists on page previews
Changes:
 - set margin-top and margin-bottom to 0 on following elements:
   ul, ol, li, dl, dd and dd

Bug: T168941
Change-Id: I80478de046d7944fde3c0de3f96f5c9dc4623c36
2017-06-30 20:51:21 +02:00
Piotr Miazga 450e6bc34c Allow events without linkInteractionToken to be logged
Changes:
 - when event doesn't have linkInteractionToken do not check for
   duplicated tokens
 - hygiene, move event duplication logic into separate functions
   for better readability

Bug: T168449
Change-Id: I3ae197567ec9f67e104af109d4f1a1c1a6769d32
2017-06-30 18:03:40 +02:00
Fomafix 75c6d5dd18 Add missing dependencies
resources/dist/index.js uses mw.user.generateRandomSessionId.

Change-Id: Id8b3d565aa76fe0451240c8679d14c77a4b2ad38
2017-06-28 13:35:39 +02:00
jenkins-bot 38970b488d Merge "Remove paragraph margins from HTML extracts" 2017-06-22 09:33:23 +00:00
Baha dac21ea832 Document decision to cache requests
The date is the date T161284 was created.

Bug: T167093
Change-Id: Ia013b2c4dec611c72ee9ac798372fdbe40a19018
2017-06-22 07:12:49 +01:00
Baha def31b9e90 Remove paragraph margins from HTML extracts
This allows us to display an exact number of lines of texts in a preview.

Bug: T168332
Change-Id: I2066fbca2fce77c9eb1f0fe4278b96f13383e9a6
2017-06-20 16:11:22 -04:00
jenkins-bot 86075fbaf2 Merge "Hygiene: Group instrumentation modules" 2017-06-20 11:06:10 +00:00
jenkins-bot 34dcf587ac Merge "build: Updating mediawiki/mediawiki-codesniffer to 0.9.0" 2017-06-20 11:05:14 +00:00
Sam Smith dcf8532cdf Hygiene: Group instrumentation modules
Following on from I4f653bba, since the schema and statsvInstrumentation
modules are similar, let's group/rename them:

  schema -> instrumentation/eventLogging
  statsvInstrumentation -> instrumentation/statsv

Change-Id: Ic59e0da7d4917f6733fd090f15d3c269af863f05
2017-06-20 11:41:37 +01:00
Kunal Mehta ba9e3c68f6 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.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: Id9e98b7a4e87d00c63e7b509506c23f12cf0d380
2017-06-20 00:19:34 -07:00
Sam Smith 67eb3b1dcf i13n: Log EL events with mw.track
Currently, the mw.eventLog.Schema class samples per pageview. However,
we expect that if a user is bucketed for a session, then all
EventLogging events logged during that session are in the sample.

Moreover, loading the class in the way that we did - asynchronously,
using mw.loader#using - introduced an issue where the eventLogging
change listener would subscribe in the next tick of the JavaScript VM's
event loop and miss the "pageLoaded" event being queued (see T167273).

Changes:
* Make the schema module follow the form of the statsvInstrumentation
  module, i.e. make it expose the #isEnabled method, and add the
  associated getEventLoggingTracker function.
* Update the eventLogging change listener accept the tracker returned by
  getEventLoggingTracker.
* Update/fix related JSDoc documentation.

Bug: T167236
Bug: T167273
Change-Id: I4f653bbaf1bbc2c2f70327e338080e17cd3443d4
2017-06-17 00:51:32 +00:00
joakin 9ed1703cf8 Test: Upgrade mw-node-qunit and use globs
To get cross-shell and OS glob support and fix some of the sinon
deprecation warnings regarding getConfig.

Bug: T168054
Change-Id: Idd6d47c1e63836c8429156cd9030ef9fda4479b1
2017-06-16 14:50:19 +02:00
joakin 98d9415361 Hygiene: Rename builder vars on require preview/model
preview/model is just a module/namespace object, not a builder class or
similar.

This patch changes a couple of imports to reference some of the exposed
functions of the preview/model where required.

In a shiny future, this pattern would be:

    const { createModel, createNullModel } =
      require( '../preview/model' )

Bug: T165018
Change-Id: If6ad4611538ca4f24e2443c0c3ed433275e995a6
2017-06-16 14:50:19 +02:00
joakin 010a4d91a6 Hygiene: Simplify gateways
gateway/*/rest were copies of gateway/restProvider just passing
a different provider. Docs were the same, they were untested, and
looking at them they seemed like unnecessary abstraction.

This patch removes the plain vs html structure, and separates gateways
like before, by endpoint.

There is a light utility in gateway/restFormatters.js that adapts the
call from the rest gateway to use formatters.js functions. It needs
testing, that I'll add in the next patch.

The flow for creating a gateway ends up as follows:

1. index.js calls gateway/index#createGateway( mw.config )
2. createGateway chooses based on wgPopupsGateway and invokes
  * mediawiki.js#createMediaWikiApiGateway or
  * rest.js#createRESTBaseGateway w/ restFormatters.js#parsePlainTextResponse or
  * rest.js#createRESTBaseGateway w/ restFormatters.js#parseHTMLResponse

Changes:
* Removed src/gateway/{plain,html}/rest.js
  * Extracted formatter functions to src/gateway/restFormatters.js
* src/gateway/plain/mediawiki.js -> src/gateway/mediawiki.js
         * tests/node-qunit/gateway/plain/mediawiki.test.js ->
           tests/node-qunit/gateway/mediawiki.test.js
* gateway/restProvider{,.test}.js -> gateway/rest{,.test}.js
* Change gateway/index.js#createGateway to properly call the rest
  gateways with the rest formatters

Bug: T165018
Change-Id: Ia75695dfc192aad5bc581a68882514bad6c29646
2017-06-16 14:49:59 +02:00
joakin 8f408e2937 Fix the npm script test:node
npm scripts are run under sh. globstar support is only available in bash
> 4 with globstar enabled, so **/*.js was actually being resolved to
*/*.js only running tests 2 directories deep.

This made the test mediawiki.test.js not run since it was moved to the
3rd level deep folder (and actually broke), resulting in:

  208 tests
  403 passed

With this change, it fixes getting the test files, and fixes the
mediawiki.test.js, resulting in:

  215 tests
  413 passed

instead.

This makes it work everywhere and as nested as it will get for now. Will
consider adding glob support to mw-node-qunit later for easier use in
other projects too.

Bug: T165018
Change-Id: Id0164b2673c8afe8a24fd0eb4aa255c134253862
2017-06-16 14:49:33 +02:00
joakin b12599c871 Hygiene: Move createGateway to gateway/index.js
And add tests, given it is growing in complexity.

Additional changes:
* Interface ext.popups.Gateway -> Gateway in docs

Bug: T165018
Change-Id: I8a12333ad9d14d6a7fbde11afc42f607881e8ea3
2017-06-16 12:46:05 +02:00
joakin 490583bcb9 Hygiene: Capture jQuery at construction
and not from global scope all the time.

Bug: T165018
Change-Id: I90b55a65a7ca25c2998c811a98401feaeced165e
2017-06-15 20:10:08 +02:00
jenkins-bot a3b5bddefe Merge "i13n: Extract experiments module" 2017-06-14 20:09:02 +00:00
jenkins-bot 08fa97d8e0 Merge "Increase line number count of preview with tall image" 2017-06-14 18:44:17 +00:00
Sam Smith 6159af3151 i13n: Extract experiments module
... from the statsvInstrumentation module so that the bucketing logic
can be shared with other instrumentation modules.

Change-Id: I5732fa539a3911939fa85fa88c102fa8dcfa5613
2017-06-14 11:04:32 -07:00
Baha 686c1306ba Increase line number count of preview with tall image
Previews with tall image now have 9 lines of text as opposed to
the previous 7 lines.

Bug: T165978
Change-Id: Ib3d39f5164663f9c9ccaa3c0a974d524fc2f9463
2017-06-14 10:22:02 -04:00
Piotr Miazga f2fbef6ec7 Implement html/rest.js gateway which handles HTML Restbase responses
Refactor existing Restbase gateway and extract shared logic into
shared Restbase provider. Also introduced new createNullModel()
which defines an empty preview model.

Additionally improve naming in new gateways/formatter so function
names are more explicity.
 * Htmlize() became formatPlainTextExtract() as it should be used
   only with plain text extracts
 * removeEllipsis() became  removeTrailingEllipsis() as it removes
   only trailing ellipsis.
 * src/gateway/index.js defines gateways by configuration name stored
   in extension.json

Bug: T165018
Change-Id: Ibe54dddfc1080e94814d1562d41e85cb6b43bfc1
Depends-On: I4f42c61b155a37c5dd42bc40034583865abd5d7a
2017-06-13 20:19:05 +02:00
jenkins-bot 9c2a4b143f Merge "eventLogging: Use base 32 instead of 16 for fnv-encoded hash" 2017-06-13 07:24:20 +00:00
Translation updater bot 39d78ebe84 Localisation updates from https://translatewiki.net.
Change-Id: Ib27d58f9128e8fada776eb70d49f9df289b0194f
2017-06-12 22:43:32 +02:00
Timo Tijhof 4996886eb9 eventLogging: Use base 32 instead of 16 for fnv-encoded hash
Follows-up 79f3b318d0.

Number#toString supports up to Base 32.
Same collision behaviour but with a shorter string.
Typical length with Base 32: 7 (max: 11)
Typical length with Base 16: 9 (max: 14)

Change-Id: I91e91341cbecdec24549ace6a6300550f5b449ee
2017-06-12 21:43:05 +01:00
joakin 38b061a468 Return empty extract if string is blank after formatting
Bug: T167626
Change-Id: Icb89cbe447226850231c3d7d74e61e5f6a5db809
2017-06-12 12:59:31 +02:00
Sam Smith fb8d54c7ce actions/rest: Use DB-key version of title
This reduces the number of 301 Redirect responses when fetching previews
from RESTBase.

Bug: T167633
Change-Id: I830947ab79e72dcc023193412c8d5bcee986e23f
2017-06-12 11:22:55 +01:00
Translation updater bot fb50482a7a Localisation updates from https://translatewiki.net.
Change-Id: I95828cf5adb566c0f77ea34ac7c485d13396a50f
2017-06-11 22:36:52 +02:00