Commit graph

2115 commits

Author SHA1 Message Date
Adam Wight 171e1b7dbf Sample ReferencePreviewsPopups 1:1
We're getting a few dozen records per day at 1:10, so let's stop sampling.
We need enough data to get significance on events happening at 0.1% or less.

Bug: T214493
Change-Id: I8a913fe1ee1e5b72d84914e183ac2386ddb20d84
2019-10-22 12:14:17 +02:00
jenkins-bot 27381dd854 Merge "Make use of User::getBoolOption() where appropriate" 2019-10-22 08:09:39 +00:00
Thiemo Kreuz e5b36f6270 Make use of User::getBoolOption() where appropriate
Bug: T233813
Change-Id: I804c34817e093fe7e507e5379647b52f187a686b
2019-10-22 09:58:47 +02:00
jenkins-bot 3240a87898 Merge "Remove obsolete mediaWiki and jQuery aliases" 2019-10-22 07:46:07 +00:00
Thiemo Kreuz 76e02fae98 Remove obsolete mediaWiki and jQuery aliases
Notice how this actually reduces the size of the final, compiled index.js.
It's not much, but still.

One issue I noticed is that the coverage reports for the JS code stopped
working. I have no idea why.

Bug: T208951
Change-Id: I2fe92579574b3b1ba4d2dd064899eee944045a96
2019-10-22 09:30:46 +02:00
Thiemo Kreuz 4d016984c3 Rename PHP constant for ReferencePreview preference
This user option is currently used in the BetaFeatures tab, but we
are going to change this with T233813. We are going to make this a
regular preference on the rendering tab, and would like to keep the
name "popupsreferencepreviews" along with all decisions the users
previously made.

Bug: T233813
Change-Id: I703d8a1a4eee2e7dccc9c597a846cf58a973ee13
2019-10-22 09:25:02 +02:00
jenkins-bot 2ad02c40d8 Merge "Localisation updates from https://translatewiki.net." 2019-10-22 07:18:24 +00:00
Translation updater bot c89d311645 Localisation updates from https://translatewiki.net.
Change-Id: I88f2e26552b078f04812b0470fca01bd7ead5758
2019-10-22 09:14:53 +02:00
Thiemo Kreuz 71ac670d9e Add visibility keywords to all constants in PHP code
Change-Id: I384cffed670c7e845465e3e18808e267327011ed
2019-10-22 07:10:31 +00:00
jenkins-bot eadbbb444c Merge "Change the extensions name on Special:Version" 2019-10-22 07:09:38 +00:00
Thiemo Kreuz c7595e54f6 Replace deprecated mw.RegExp.escape() with mw.util.escapeRegExp()
The signature mw.RegExp.escape() is deprecated since MediaWiki 1.34.

By the way, this is the 4th or even 5th time in my short career this
tiny, single line (!) helper function is moved around and I need to
update all my code. This felt already ridiculous when it happened the
2nd time.

Change-Id: I4d05a49120aff64ebc316d0af7736c62385d9307
2019-10-21 15:00:36 -07:00
jenkins-bot 4476eb7f75 Merge "Upgrade Popups mw-node-qunit version" 2019-10-21 11:07:57 +00:00
Translation updater bot 385beb32cb Localisation updates from https://translatewiki.net.
Change-Id: Id4a099066ccdd0be624409b3bf528aa8ce3ff8bf
2019-10-21 10:00:29 +02:00
jenkins-bot 1fa04d10da Merge "Replace all mock builders with createMock() calls" 2019-10-18 16:26:04 +00:00
Thiemo Kreuz fe32c48268 Replace all mock builders with createMock() calls
This was motivated by two things:

1. Notice the bad class name in UserPreferencesChangeHandlerTest. This
was possible because the default mock builder does not check if a class
exists, *and* there was no type hint in place. createMock() *does* check
if a class exists.

2. We are free to use createMock() from PHPUnit 5+ now. It's not only
shorter but more strict and reliable.

Change-Id: I301a171d587026eab0a62575ab2fdbfd7733c661
2019-10-18 14:31:10 +00:00
Translation updater bot f237c80c93 Localisation updates from https://translatewiki.net.
Change-Id: I308109c44e1ec64e43311c4c2868db74c1ac41f9
2019-10-18 09:29:29 +02:00
jenkins-bot 7952203c61 Merge "Split user preferences for Page and Reference previews" 2019-10-17 09:46:21 +00:00
jenkins-bot cccadd8d05 Merge "Refactor PopupsHooks for easier removal and/or expansion" 2019-10-17 09:46:18 +00:00
Thiemo Kreuz fb5809d61e Change the extensions name on Special:Version
The extension is not only about "Page Preview" any more. It already
renders Reference Previews, and might render math expressions as well.

Bug: T219153
Change-Id: I5aa616d9eff3e65e018a9d64955b8d32d4f7e690
2019-10-17 11:41:47 +02:00
Thiemo Kreuz a63a1cf91c Split user preferences for Page and Reference previews
Bug: T233813
Change-Id: I89205658c561961b90abaa133a004e54beebfab5
2019-10-17 11:21:21 +02:00
Translation updater bot 3cb86c0b28 Localisation updates from https://translatewiki.net.
Change-Id: I2f127c7ce0ae1980b6a70d4771129f43f286b1c9
2019-10-16 20:41:22 +02:00
Thiemo Kreuz 55505e786b Refactor PopupsHooks for easier removal and/or expansion
This is done in preparation for the main patch I8920565. This patch
here is not supposed to change anything. Tests should prove this.

Bug: T233813
Change-Id: I0bdc35dc8cb7bca643f45734b30e374f26b24ad2
2019-10-16 13:33:09 +00:00
Translation updater bot f6af4ca68e Localisation updates from https://translatewiki.net.
Change-Id: If0c55a7452b1211a43efa6dbf268b7438c6729bf
2019-10-16 10:40:42 +02:00
James D. Forrester e16143df16 build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: Icd67aed448269f603dd4465f7e46eac9a64bd1a1
2019-10-15 16:13:01 -07:00
jdlrobson 7d6a903d69 Upgrade Popups mw-node-qunit version
Bug: T203137
Change-Id: I0cf856d04eacf5bf7764c58db55eeae04811e973
2019-10-15 15:36:54 -07:00
Adam Wight f6defd5fbc Tune referencePreviews sampling from 1:1000 to 1:10
We've logged zero events after 12hr of deployment, so it should be
safe to increase sampling by 100x.

Bug: T214493
Change-Id: Icd67aed448269f603dd4465f7e46eac9a64bd1ab
2019-10-11 10:52:43 +02:00
Thiemo Kreuz 95c80dcb3e Fix code detecting horizontal scrollbar in reference previews
Bug: T234602
Change-Id: I5994b6e8cb15374bb2c0a31dd4e4549005a619cf
2019-10-09 15:38:35 +02:00
Translation updater bot 2562ca2e9c Localisation updates from https://translatewiki.net.
Change-Id: I4a8aec4918f39a3b2494c6b2aa28ef9799487e74
2019-10-08 09:34:15 +02:00
Ed Sanders af07b4214e build: Update linters
Change-Id: I4170001345e511cc47ebe77977433488b6f1b523
2019-10-07 16:32:01 +01:00
Adam Wight 76a34618c3 Tracking for Reference Previews interactions
Logs events to the ReferencePreviewsPopups EventLogging schema, in
order to understand whether Reference Previews is helpful for
end-users.

This will be removed along with the older tracking, as soon as our analysis
phase is finished.

Incidentally disables a lint rule for the generated JS, it's about
readability so irrelevant to the minified code.

Bug: T214493
Change-Id: I2638611ba67b785338f7e98a1c4b08a5e829812d
2019-10-07 11:22:00 +02:00
Max Semenik b72a95b5c0 Fixes for PHPUnit 6
Bug: T192167
Change-Id: I354077e8e44cfea3e75219d6701a4f9e11d4c70a
2019-10-05 22:43:20 -07:00
Thiemo Kreuz 3eb7c9b976 Replace all loose assertEquals with strict PHPUnit assertions
A method that is expected to return, for example, a boolean true
should not return an other value that PHPs loose == comparison might
also consider true.

Same for all other loose equality checks.

Change-Id: If729c6e97d5337eee10b717da76dad428218ff69
2019-10-04 10:34:21 +02:00
jenkins-bot 33a96c7ab2 Merge "Collect metrics for logged-in users as well as anons" 2019-10-04 08:02:13 +00:00
Translation updater bot 6a6603a336 Localisation updates from https://translatewiki.net.
Change-Id: I33f1a580546433acdee583b8aebcee62acbcf8ac
2019-10-02 09:22:49 +02:00
Adam Wight aa6972c277 Collect metrics for logged-in users as well as anons
The eventlogging `isEnabled` function determines when to sample,
this patch removes the `isAnon` conditional so that we can measure
reference reading habits for all users.

Also guards against a non-function navigator.sendBeacon, which was
previously intended but incorrectly tested.

Bug: T214493
Change-Id: I42cb3082fb85c7900426a2055dfa3c2f6ecfd968
2019-09-27 12:07:11 +02:00
Adam Wight 375d27bbf7 Update to a newer Schema:Popups
When ?debug=1, we send eventlogging with previewType=reference.  This
is only supported by a newer schema than we had specified.

Change-Id: Ic7558820df5945ccf287ca2211311b2bf0bf5219
2019-09-23 16:18:08 +02:00
Translation updater bot 3a087e6bfe Localisation updates from https://translatewiki.net.
Change-Id: I720ca5d7c3c2bb1878b85e5cc7af352801072f37
2019-09-23 09:26:38 +02:00
Ed Sanders 9b3029e0ee Build: Update linters
Change-Id: Ia2a833a01e1bb05d6be3923dd452b1851afd7655
2019-09-17 12:47:25 +01:00
Translation updater bot eef49add06 Localisation updates from https://translatewiki.net.
Change-Id: I8fcf852de0277bd503e25fe1434bf28dc2aa039c
2019-09-17 09:09:31 +02:00
Translation updater bot 00d90c7efc Localisation updates from https://translatewiki.net.
Change-Id: I579597dd6da667e1c1453e00bfb56db7b4685355
2019-09-16 09:56:54 +02:00
Translation updater bot 2e1d8fa744 Localisation updates from https://translatewiki.net.
Change-Id: I41922e6298f0be6daa6368277b3314063bf41fcd
2019-09-13 10:20:17 +02:00
Translation updater bot ee5e807856 Localisation updates from https://translatewiki.net.
Change-Id: If33932b9c7c57f8382047f06c58a01c0595289fd
2019-08-30 10:04:41 +02:00
Translation updater bot 17dfca6a36 Localisation updates from https://translatewiki.net.
Change-Id: I1895578345a2c7984fdf9f83ecfa665172b993bb
2019-08-27 11:05:12 +02:00
Translation updater bot 484b6fbcf7 Localisation updates from https://translatewiki.net.
Change-Id: I0989358412fd16c07f2b25a65b6f3f2e0e42496c
2019-08-25 10:31:02 +02:00
WMDE-Fisch 69caa6ec3d Add browser tests for quickly hovering links
Bug: T219434
Change-Id: I3597b8025f7a12db0cf5d83cce5a77abace9bae3
2019-08-23 08:21:14 +00:00
Thiemo Kreuz 065a8e9631 Fix action reducer forgetting *all* duplicate dwell actions
I was able to track the issue down to the changes made in this patch:
https://gerrit.wikimedia.org/r/331563

This patch is mostly a simplification of ce8a2d4
(I9a73b3086fc8fb0edd897a347b5497d5362e20ef):

- Don't make wait#wait() abortable. This adds complexity and isn't
  needed since the token is rechecked in the .then() of
  actions#linkDwell(). The request is permitted to continue and fetch if
  that token still matches and is never issued otherwise.

  Once a request has been issued, that request is still abortable.
  However, note that calling XHR.abort() is just a request to abort and
  may not be granted. Whether or not XHR.catch() is invoked is what
  dispatches the FETCH_ABORTED action (or doesn't if the request to
  abort was denied).

- Remove the abort tests for wait#wait() since the functionality is no
  longer provided.

- Pass the preview token in the FETCH_ABORTED action and reduce
  FETCH_ABORTED the same way as ABANDON_COMPLETE in reducers/preview.

The follow-up patch, I3597b8025f7a12db0cf5d83cce5a77abace9bae3, adds
integration tests for the specific bug fix. Note that these Selenium
tests are incompatible with the content proxy, so it is probably best to
simply unset $wgPopupsRestGatewayEndpoint and $wgPopupsGateway and allow
the defaults to be used. Also note that the tests are incompatible with
recent versions of Node.js (so use NVM) and emit many deprecation
warnings (so set deprecationWarnings to false in
tests/selenium/wdio.conf.js) An example run of the tests looks something
like:

  chromedriver --url-base=wd/hub --port=4444 &
  # If any changes are made locally, also run `npm -s start &`.
  MW_SERVER=http://localhost:8181 \
  MEDIAWIKI_USER=foo \
  MEDIAWIKI_PASSWORD=bar \
  DISPLAY= \
  npm -s run selenium-test

Live testing may be performed as well. Remember that RESTBase requests
are incompatible with MobileFrontend's content proxy hack so ensure to
comment it out if $wgPopupsGateway is configured for RESTBase (see
T218159).

1. Open the DevTools network tab.
2. Disable the browser cache. Chromium, at least, won't abort requests
   coming form the cache.
3. Hover back and forth quickly over a preview. In Chromium, canceled
   requests are labeled and appear red. This is a good scenario to test.
   With the patch, a preview should always be shown when ultimately
   resting on a link. Without the patch, it is possible to rest upon the
   link with no preview showing. This may require several attempts.

Bug: T219434
Change-Id: I9da84b0296dd14e9ce69cb35f1ca475272fb249a
2019-08-23 10:08:19 +02:00
libraryupgrader 9c1f918440 build: Updating eslint-utils to 1.4.2
* https://npmjs.com/advisories/1118

Change-Id: Ib5e2042c7a007c8a20e329b8a99a61a8faea2601
2019-08-23 02:21:08 +00:00
libraryupgrader ca30a90a70 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 24.0.0 → 26.0.0

npm:
* set-value: 2.0.0 → 2.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* union-value: 1.0.0 → 1.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* mixin-deep: 1.3.1 → 1.3.2
  * https://npmjs.com/advisories/1013
  * CVE-2019-10746
* lodash: 4.17.11 → 4.17.15
  * https://npmjs.com/advisories/1065
  * CVE-2019-10744
* wdio-mediawiki: 0.2.0 → 0.4.0

Change-Id: I6d8d0e35f5dd0eb19d42cc57547ede5e38e1fa68
2019-08-15 19:40:36 +00:00
jenkins-bot 7bbd0e71f2 Merge "eslint: Enforce template-curly-spacing" 2019-08-15 08:57:57 +00:00
Ed Sanders 4d885286a3 eslint: Enforce template-curly-spacing
Change-Id: I5640e86cba25f6100c7814c2ef8a845941f73497
2019-08-15 10:24:43 +02:00