Commit graph

1998 commits

Author SHA1 Message Date
WMDE-Fisch 0d2d6d4c9b Move getPreviewType form gateway to model
The method itself has not much to do with gateways as such, it's
more about the general preview type selection. Since the preview
types "live" in the model, I thought it might good to move it there.

Doing that the "original" getPreviewType method in the model was renamed
to avoid conflicts. If I get this right, that method is quite specific to
page previews, since it processes the output from the TextExtracts API-
request. - Therefore I also removed the TYPE_REFERENCE there, because this
code path will never be reached with that type afaik.

Inspired by the comments in Id1fa7dad59d8fe80bc60c1e2d7c3fb4087e52d1f and
as preparation for that patch.

Bug: T215420
Change-Id: Ic9e24a73e945c7d56435c656ecfdb42b65601d22
2019-03-12 08:28:46 -06:00
WMDE-Fisch 3915dd166f Remove unused parameter
As far as I can see this is not used in the method.

Change-Id: I0d6373ba5697fbc228552465e1e8d95c05720132
2019-03-11 16:51:49 -06:00
jenkins-bot 23a4f6cbba Merge "Change delay for ReferencePreviews to 150ms" 2019-03-11 22:46:00 +00:00
WMDE-Fisch 4803a717ad Change delay for ReferencePreviews to 150ms
Bug: T215420
Change-Id: Id1fa7dad59d8fe80bc60c1e2d7c3fb4087e52d1f
2019-03-11 16:37:53 -06:00
Thiemo Kreuz e32fc4914e Add some missing newlines to separate PHP code better
I believe these additional newlines all make the code easier to read.
It's easier to see what belongs together, and what is a separate thing.
I found the Squiz.WhiteSpace.FunctionSpacing sniff very helpful to
enforce this code style. We enabled this already in almost all WMDE
codebases. It is not yet part of the upstream MediaWiki rule set, but
discussed.

Change-Id: Ibdf788529b28637bf98e7940c2516852c3afcef7
2019-03-11 11:33:13 +01:00
Translation updater bot 1e620a5df8 Localisation updates from https://translatewiki.net.
Change-Id: Ia71a10c9b425182fb8f625e9daf9f77f2d895e12
2019-03-10 22:27:52 +01:00
jenkins-bot 96487a79f5 Merge "Localisation updates from https://translatewiki.net." 2019-03-08 21:40:19 +00:00
jenkins-bot b5599d14fa Merge "Build: synchronize Webpack config with MobileFrontend" 2019-03-08 21:40:17 +00:00
Translation updater bot 024f1d726a Localisation updates from https://translatewiki.net.
Change-Id: Ib0d0c929195af24ed3efa942f820488c731d35df
2019-03-08 22:29:28 +01:00
jenkins-bot e341ec8268 Merge "Clean up PHPDoc documentation tags for constants" 2019-03-07 21:51:26 +00:00
Translation updater bot c0712bf8c9 Localisation updates from https://translatewiki.net.
Change-Id: I8e761e93e366692e6b9baa35a568fe7324d89247
2019-03-07 22:41:00 +01:00
Stephen Niedzielski b3dd38c8aa Build: synchronize Webpack config with MobileFrontend
Minimize the difference between MobileFrontend and Popup's
configuration where possible. No build delta was generated so the change
is expected to be nonfunctional.

- Set the Webpack configuration file's ESLint environment to Node.js
  instead of manually specifying Node.js globals.

- Directly export the configuration as a function instead of persisting
  a local and assigning it to module.exports at the end.

- Export the configuration as a function and replace Node.js variables
  with Shell compatible parameters. This required inlining a couple
  single-use variables. See
  I83e507fad1ee2f477bb95c2987d0b24f082b2165.

- Reorder configuration and update comments to match MobileFrontend.

Change-Id: I24545da2d029d08b0ea0e1330b6bb71ce423e6b7
2019-03-07 13:37:59 -07:00
Jan Drewniak bdb535c643 Add SVG masks to Storybook app
The SVG masks used for previews are clip paths, making it hard to
visualize what their actual shape is. This patch extracts the paths
inside those clip paths into new SVG objects and renders them in
the Storybook app.

Also removes a few previews from the portrait/landscape thumbnails
so that the Knobs addon can function properly.

Change-Id: I160746d8877deaa12ace925ce170323946ce532d
2019-03-06 14:21:33 +00:00
Translation updater bot 28ce5a8075 Localisation updates from https://translatewiki.net.
Change-Id: Idb7b6ff1bd9c804e4a0c02ce989a3aece5a59ce6
2019-03-05 22:42:55 +01:00
jenkins-bot 8fb90dfb11 Merge "Minor code optimizations in SVG files" 2019-03-05 19:57:44 +00:00
WMDE-Fisch b6c1ea3f03 Minor code optimizations in SVG files
Change-Id: I8c9b1a7c2cc11690d72f4c851d598b68560bcf36
2019-03-05 19:29:20 +00:00
Translation updater bot 541892823d Localisation updates from https://translatewiki.net.
Change-Id: I20b2daa3068505fde12a1f6e64d064b285a6c08b
2019-03-04 22:16:16 +01:00
Translation updater bot 7fceb75fbf Localisation updates from https://translatewiki.net.
Change-Id: I28936626849709e7aaccee0b3247142e67abd5e7
2019-03-03 22:17:47 +01:00
Translation updater bot b5e5435644 Localisation updates from https://translatewiki.net.
Change-Id: I321d4250bc816512fbd2cf9e31bda6976401c314
2019-03-02 22:42:42 +01:00
Thiemo Kreuz 1cf4e5902b Enable Squiz.Strings.DoubleQuoteUsage PHPCS sniff
The majority of this was fixed just recently via I8de42df. The sniff
makes sure all old and new code conforms to this style.

Change-Id: I8aecf3653d021fc8f86abcdc5939529864f86a48
2019-03-01 11:28:20 +01:00
Derick Alangi 8fa98056f7 PopupsContextTest: Improve the PopupsContext test suit
-> Use single quotes for string literals.
-> Document missing parameter in test method.

This is just to improve on code readability, consistency
and maintainability.

Change-Id: I8de42df9f856ecb409637fe33b5f84b8bed1b547
2019-03-01 09:38:17 +01:00
Translation updater bot 4c3f4d3fe0 Localisation updates from https://translatewiki.net.
Change-Id: Ib7067710c1a3e2d1332ee0b8cbe2b014fca19f87
2019-02-28 22:25:10 +01:00
WMDE-Fisch 5da1009d4b Fix shade of blue in beta feature images
Bug: T215896
Change-Id: I19b7098afc176f929951c8a51a000393eabd6f32
2019-02-27 14:19:11 +01:00
WMDE-Fisch 7e6afa7bbb Add missing "the"
Bug: T215896
Change-Id: If04f26d4d134ba58e1121331879bb01e825cd955
2019-02-27 13:46:55 +01:00
Stephen Niedzielski 7c4836afdf Hygiene: fix typo in ServiceWirings function arg
Change-Id: I4f4ca2f1c1943928475bfcb42092cb26ab7ed712
2019-02-26 15:39:18 -07:00
jenkins-bot ac6e03cc0d Merge "Update documentation and signatures of hook handlers" 2019-02-26 22:30:57 +00:00
jenkins-bot 33e29e9041 Merge "Remove unused $config constructor parameter from loggers" 2019-02-26 22:00:57 +00:00
Thiemo Kreuz 1697cb9a65 Update documentation and signatures of hook handlers
* Explain the difference between the two hooks that both set config vars.

* Remove by-ref & that are not needed. This is a non-breaking change.
Even if the code calling a hook handler provides a variable by reference,
the hook handler being called does not need to require a reference.
Removing these & makes the code less confusing and easier to read.

* Replace an OutputPage type hint with a more narrow IContextSource.
That's all this code actually needs to know. It doesn't need access to
the entire OutputPage, so it doesn't need to require it.

* Update the signature of the ResourceLoaderGetConfigVars handler to
match the caller.

Bug: T215896
Change-Id: Ie1e4b50cd954812f71dd628003b8e9d40fdf5fe8
2019-02-26 17:45:39 +00:00
jenkins-bot 6ef117c3fa Merge "Increase whitespace between reference text and read link" 2019-02-26 16:17:07 +00:00
Thiemo Kreuz 6ec5ac46a5 Increase whitespace between reference text and read link
For popup types other than references this particular margin is calculated
as "2 lines + 7", which results in 47px.

The calculation implemented with this patch results in 55px. That's 8 more.

This also increases the total height of reference popups by the same amount.

Bug: T214169
Change-Id: Ie7870717d2fd2ce78268d1fc1b79d87eff059318
2019-02-26 15:47:52 +00:00
jenkins-bot 6b69b7fd01 Merge "Bring reference type detection in sync with RESTbased endpoint" 2019-02-26 13:56:55 +00:00
jenkins-bot 458b5833f1 Merge "Update type-specific reference headings according to requirements" 2019-02-26 13:52:40 +00:00
Thiemo Kreuz 0beabf2bdf Bring reference type detection in sync with RESTbased endpoint
The RESTbased references endpoint accepts multiple <cite> tags, as long
as they do not have conflicting types.

As specified at
https://www.mediawiki.org/wiki/Page_Content_Service/References#Decisions

Bug: T215281
Change-Id: I8a7d2d6da8a8d9746b971417833b954d1f1d6041
2019-02-26 14:51:53 +01:00
jenkins-bot f812611470 Merge "Add reference type detection to HTML scraping gateway" 2019-02-26 12:23:47 +00:00
jenkins-bot 909585c197 Merge "Remove object passed by references to method" 2019-02-26 11:32:13 +00:00
Derick Alangi f3d415fd27 Remove object passed by references to method
-> Objects by default as passed by reference so removed & in front
   method header.

In addition, updated the PHPDoc comments to reflect the changes.

Change-Id: I69ad2090205f6bd694744779d2c46a3506c85378
2019-02-26 11:26:07 +00:00
Thiemo Kreuz 54af069999 Remove unused $config constructor parameter from loggers
As suggested in I69ad209.

As far as I can tell the idea was to be able to pass logger-specific
configuration to the logger factory, e.g. to be able to toggle certain
things the loggers would do. But this is not used at the moment. There
is not much value in keeping unused code around. It can esaily be
introduced again later when it turns out it is needed.

Furthermore, I'm told most of the logging functionality should be
removed anyway. See T193051.

Change-Id: I6b1ddb2a65eacc0e096f2ba44922d63e63212a65
2019-02-26 12:20:59 +01:00
Thiemo Kreuz 7e41bed5d0 Update type-specific reference headings according to requirements
According to the now refined acceptance criteria in T215281.

Bug: T215281
Change-Id: Ib96ce2289ecdda36ca4621b2237acf0a7bc49df5
2019-02-26 12:02:32 +01:00
Thiemo Kreuz bffa3178d5 Clean up PHPDoc documentation tags for constants
Our documentation generator Doxygen is not able to understand @var tags
on constants. A constant is neither a "variable", nor is it possibly to
specify an allowed type for a constant. The type of a constant is strictly
derived from it's value. There is no way to change it, other than changing
the constant itself. There is not much value in repeating the type either.
If it's critical to know the type of a constant (which is a very rare
situation), that should be better explained in the comment.

Doxygen strips all @… tags it does not understand, and renders everything
else as a plain string. This makes it possible to use something like:

/**
 * @const Description…
 */

But this is not different from:

/**
 * Description…
 */

Change-Id: I4531d4f6b2ab2aca7a62f13f10a655f31c4d6a7a
2019-02-26 09:56:07 +01:00
jenkins-bot ef3bda840a Merge "Add a beta feature switch for reference previews" 2019-02-25 23:22:42 +00:00
Translation updater bot ec1dc0e4d5 Localisation updates from https://translatewiki.net.
Change-Id: Iaca580e27d522c631bca0e77f290324b56623071
2019-02-25 22:58:26 +01:00
Andrew Kostka f91c160214 Add a beta feature switch for reference previews
Bug: T215896
Change-Id: I6a4cc2103d594dc11f62da247891d3f190619899
2019-02-25 20:38:12 +01:00
Thiemo Kreuz e1111c59b7 Add reference type detection to HTML scraping gateway
This is effectively an alternative for T214908.

Bug: T214908
Bug: T215281
Change-Id: Ib8898474929271dd27b49c59401fa7f887120cdb
2019-02-22 16:55:41 +01:00
jenkins-bot 8469e87426 Merge "Hygiene: improve ESLint globals readability" 2019-02-22 09:04:35 +00:00
Translation updater bot 22d7fb3653 Localisation updates from https://translatewiki.net.
Change-Id: Iecbce1d83da5f7a58630ce853a93a7fd91ccf21b
2019-02-21 22:21:30 +01:00
Stephen Niedzielski 240f070dee Hygiene: rename test import to match source
Rename selectInitialGateway() to selectGatewayType() in
gateway/index.test.js. This test's import name was out of sync with the
declaration which made it more difficult to grep and reduced
consistency.

Change-Id: I60ae359043fdf76015d75b6438992ef6061a4d72
2019-02-21 09:32:25 -07:00
Thiemo Kreuz d1c0613186 Fix regression showing page previews on ^ jump mark links
This happened one time before and was fixed via T212419. It now came
back after I2670331, a patch for T214861 that made the title parser
accept more links than before.

This patch implements a decision tree that goes as follows:
1. If it's a link to another page, it can't be anything but a page
   preview, as having a peek into another page is effectively the
   definition of a page preview.
2. Otherwise it's probably a reference preview, but only if:
   * It's a link with a jump mark.
   * The link is actually marked as being a "reference".
   * Reference previews are enabled.
3. If neither of these definitions fit, do nothing. Note this is not
   "hiding errors" we would be able to fix in this code. There are many
   ways to manually arrange wikitext in a way that it looks like one or
   the other, without fulfilling all requirements. Unfortunately the
   user who would see error message or dysfunctional popups would not
   be the same as the user who wrote such wikitext.

Bug: T216683
Change-Id: I8d021f19ddc73a261e6a0c62959ddd0cb1d3182d
2019-02-21 09:30:35 -07:00
Stephen Niedzielski deffae141c Hygiene: improve ESLint globals readability
- Drop unused moment, Redux, and ReduxThunk globals.

- Instead of using a confusing and deprecated boolean, specify that
  globals are "readable" / "writable"
  https://eslint.org/docs/user-guide/configuring#specifying-globals

Change-Id: I711a4ea7c51c9a560f20fc28bc99bd932c7e1e25
2019-02-21 07:59:56 -07:00
Thiemo Kreuz 06d348041e Use upper-case {JQuery} in all documentation
See the discussion at I6bd7acc. In this codebase it was decided to not
use "classic" JavaScript, but document it with the benefits TypeScript
comes with. Since I27b5cb0 a dev dependency is in place that makes the
upper case JQuery type work.

All the lower-case jQuery this patch happens to touch have been placed
by me, not knowing better at this point.

Change-Id: I76ef8eabaf4850f07b140dac6f489df37422263e
2019-02-21 13:29:45 +01:00
Thiemo Kreuz 032e9ad004 Limit reference popups to max. 5 lines instead of 7
We run into some confusion with the previous patch Ifcc355f, and
decided to talk about the max-height for reference previews later. The
result of this conversation is this patch here.

The mocks and discussions in T214169 mention several numbers that all
conflict a little bit. In detail:

* We ignore the mentioned "4 lines", but go with 5. We assume the 4 is
a mistake. Using 5 is consistent with all mocks and all given pixel
measurements.

* The mock ask for a max-height of 106px for the container. With this
patch it's 100px, which is exactly 5 lines. The extra 6px don't do
anything as far as we can tell, but make the code confusing.

* The mock asks for 215px for the whole popup. With this patch it's
203px. Note this number is (intentionally) not hard-coded anywhere but a
result from all line heights, line counts, paddings and margins combined.

Bug: T214169
Change-Id: I18f61ed02ed506d48e3834e2ebc48b3392f7d732
2019-02-21 12:06:46 +01:00