Commit graph

2804 commits

Author SHA1 Message Date
Translation updater bot a17b5deb70 Localisation updates from https://translatewiki.net.
Change-Id: I0048cef61d4ea7805e7c873f6b95a10f18cbfd7b
2021-04-22 09:32:05 +02:00
jenkins-bot a6e4fd5def Merge "build: Replace Grunt tasks with npm scripts for eslint, stylelint, banana-checker & svgo." 2021-04-21 23:48:41 +00:00
bwang 2081ab4bf3 build: Replace Grunt tasks with npm scripts for eslint, stylelint, banana-checker & svgo.
Changes of note:
- The doc and node-debug jobs are moved to ensure that all test prefixed
jobs are together in the package.json manifest.
- 2 additional scripts are added (linter:js & linter:styles) to match WVUI's NPM script naming convention.

Bug: T206462
Change-Id: Ib84f93c20f13aefb2d8f8755261b1f14e5902f16
2021-04-21 22:25:17 +00:00
Thiemo Kreuz 25e7143f4c Fix icon placement in reference previews
The icons are all slightly misplaced since Iba5367f (T277663).

This patch also replaces the deprecated variable @iconSize.
This is only about the variable name, the value doesn't change.

Bug: T280762
Change-Id: I9ce00aed5a91a95b64427d63881784196f94169b
2021-04-21 17:50:08 +00:00
Thiemo Kreuz c281bb9302 Clean up code enabling individual popup types
We still have 2 different mechanisms in place, maybe even 3:
* We simplify the CSS selector when we know a popup type is
  disabled, and it's impossible an anonymous user can enable it
  at run-time.
* We create that "initiallyEnabled" map that allows anonymous
  users to toggle the individual popup types at run-time.
* This map is also used to check if the footer link should be
  shown.
* There is also a wgPopupsReferencePreviews global that acts as
  a "kill switch". However, this is not a pure feature flag,
  but incorporates the user setting for registered users. This
  is currently partly redundant (checking
  `mw.user.options.get( 'popupsreferencepreviews' )` does the
  same) and can be removed later when the feature flag is not
  needed any more.

The footer link currently acts odd because anonymous users are
unable to enable ReferencePreviews, but get the footer link.

This patch introduces a 3-state model:
* `true` acts as before.
* `false` means a popup type is disabled, but anonymous users
  can enable it (i.e. this is the opt-out behavior for anonymous
  users).
* `null` means a popup type is not available at run-time, for
  nobody. Anonymous users can't do anything about this.
  Registered users must leave the page and change a setting.

Bug: T277640
Change-Id: Id8d1396c09cf0f706034a66f9cd3c880a8b33df8
2021-04-21 19:38:25 +02:00
Svantje Lilienthal cf9258b0c5 Changed radio button to checkbox in anonymous user settings window
Bug: T277639
Change-Id: Ifa84dda88a8a167fc8ed2cef17254c1b722ade2d
2021-04-21 14:13:47 +02:00
jenkins-bot fa3f2fe4af Merge "Fix bottom margin as long as settings icon isn't shown" 2021-04-21 11:04:21 +00:00
Thiemo Kreuz e19b557227 Merge duplicate ReferencePreviews Beta feature flag
Change-Id: Ia7f1c9128460bc5a139e37eb16fff649e80cd20f
2021-04-21 10:46:05 +02:00
jenkins-bot 700f8ed306 Merge "Minor cleanups to QUnit test setups" 2021-04-21 07:46:29 +00:00
Translation updater bot fadf62f691 Localisation updates from https://translatewiki.net.
Change-Id: I994d91b48283de0f42f9064144d38dc85a5a5411
2021-04-21 08:53:06 +02:00
bwang 6c7a922547 Update package-lock.json
This patch removes "optional" from the package-lock.json, which is a property introduced in npm v6.6+, while our nvm specifies npm v6.4.1

Change-Id: I43983688d8f26e68b454e42410760b270dced48c
2021-04-20 20:54:30 +00:00
jenkins-bot a2478add67 Merge "Remove dead code around cog wheel dialogue" 2021-04-20 07:43:08 +00:00
Translation updater bot e7485da092 Localisation updates from https://translatewiki.net.
Change-Id: Icf29c65a6069b7edc2dd5551a0efd492d9be8ee1
2021-04-19 08:51:13 +02:00
Thiemo Kreuz 3466e66995 Minor cleanups to QUnit test setups
* That `this.user` is unused.
* Some tests missed a module name. This means they are reported
  as part of the previous module. While this is purely cosmetic,
  it's confusing to see the wrong module name in the report.

Change-Id: I73915d3c4fd9a03bda1ddc8dff6dd5539113c3cd
2021-04-16 13:23:10 +02:00
WMDE-Fisch 190962cc5b Remove dead code around cog wheel dialogue
An "advanced" option was first introduced in 2014 via patch I374805e
(originally named "monitor-or-edit", renamed via patch I7b4f6d2).

The isNavPopupsEnabled() function was added in 2016 via patch
Ic660f48.

The code that disables the extension entirely the moment the NavPopups
gadget is enabled was added in 2017 via patch Ia474b1b (T151058) and
patch Ia837816 (T160081).

As of now, the "advanced" option can only be seen in an extreme edge
case:
* Only for anonymous users.
* Only if NavPopups is enabled by default for anonymous users.
* Only if the $wgPopupsConflictingNavPopupsGadgetName setting is
  misconfigured.
* … or if NavPopups is not a gadget in the first place, but e.g.
  loaded via Common.js.

In this situation the settings dialog opens with all *3* options. This
is broken for several reasons:
* The "simple" option enables the extension, but doesn't disable
  NavPopups. Both trigger, resulting in both popups being displayed
  the same time.
* Since "simple" is the default, this bogus behavior is the default
  for anonymous users.
* The "off" option doesn't stick. Every time the settings dialog opens
  "advanced" is checked instead.
* "Off" can't work anyway. There is no code to disable the gadget.
* Only the "advanced" option "works", but more by accident.

It's unclear how to fix this:
* There is no code that does anything with the "advanced" option. It's
  not even stored. The behavior of the option is identical to "off".
* The code appears as if "advanced" was meant to be shown instead of
  "off". I.e. anonymous users can only choose one of the popups, but
  not disable both. But there is no code to hide the "off" option.
* The bug when both popups are displayed was fixed in 2017 via an
  entirely different mechanism. Re-introducing "advanced" does not
  only mean duplication, it's unclear how the 2 mechanisms are meant
  to work together.

It really, really feels like this was just forgotten.

Bug: T278949
Change-Id: Iab21f3a649a5b2f19ebb0d0dbb45ce1450c65678
2021-04-15 15:29:16 +02:00
Andrew Kostka 398565b1d6 Track anonymous enables/disables of reference previews
Bug: T277641
Change-Id: I89ee3ff280e79f560bf613a110a1c9e0b3ba6648
2021-04-15 14:21:32 +02:00
Thiemo Kreuz 622fb6c5e8 Allow to disable/enable popup types individually
Bug: T277639
Change-Id: I0742b8ab1c5ed0b374d4f9447bebc46a35207339
2021-04-15 11:30:36 +02:00
Thiemo Kreuz 4b1f020b9d Avoid hard to read jQuery.extend() in tests
… as well as in one place in production code. The motivation
for this change is to make the code easier and faster to read.
There is a little bit of duplication in the test setup now.
But I would like to argue this is a good thing. The values are
rather trivial. The difference (or absense of a difference) is
much easier to see now.

Change-Id: I9aa95b59f0c45ea7c9257970e2fcdba3a000d234
2021-04-15 10:47:44 +02:00
Thiemo Kreuz b28f48d6d6 Rename variables in change listeners for clarity
This patch does nothing but rename a pair of variables:
"prevState/state" becomes "oldState/newState". Reasoning:

1. The abbreviated "prev" is confusing, especially because we
are in a codebase that is all about "previews".

2. We are in a context that is all about a state **change**.
Change listeners get notified about the change from one state
to another. While it would be possible to stick to the already
mentioned "previous/current" terminology, I find the word
"current" confusing. What is "current" in this context? Did
the state already change? Am I notified about a change that is
**going** to happen or already happened? Is this even relevant?
I don't think it is. Therefor "old/new".

Another possibility is "previous/next".

Change-Id: Id886e1a095967fe86fb9021f59e335c62da8994e
2021-04-15 10:19:40 +02:00
Translation updater bot b25a9d7935 Localisation updates from https://translatewiki.net.
Change-Id: I674dce17b80a01eb1a9a124cce91f033588af9e2
2021-04-15 08:43:55 +02:00
Thiemo Kreuz a35e35e3b3 Expand userSettings module for reference previews
Bug: T277639
Change-Id: I13acfb8bcc6e95fc28969072ec5420fd075d5096
2021-04-13 12:19:49 +02:00
Thiemo Kreuz 51dd4b2807 Make nextState support non-flat updates
The nextState() function was not able to understand updates that
are deeper than a single level. Example:

nextState( state, { pagePreviews: { enabled: true } } )

Before, this would replace whatever was in the "pagePreviews"
property with { enabled: true }, but not merge it. In some places
a single level of recursion was done manually because of this.
This can be removed now.

This is done in preparation for splitting the "enabled" flag into
separate ones for each popup type.

Bug: T277639
Change-Id: I35911c18018ba7cd1633a4c882b978656c3fee36
2021-04-12 13:46:18 +02:00
Translation updater bot 6dd616bab9 Localisation updates from https://translatewiki.net.
Change-Id: I5b1097b3e04bbbe19747ff14ea0574f051d5e983
2021-04-12 08:38:37 +02:00
Translation updater bot c09031c177 Localisation updates from https://translatewiki.net.
Change-Id: I716dc607010a31408ec699a874bc43ace1527817
2021-04-09 08:59:02 +02:00
Thiemo Kreuz ddf574afa3 Remove not needed userSettings.hasIsEnabled()
Note how getIsEnabled() is documented: "if the user hasn't
previously enabled or disabled Page Previews […] then they
are treated as if they have enabled them."

In other words: The idea that the default should be true is
encoded twice in this code. This is just not necessary. We can
remove one without loosing anything.

Motivtion: Simplifying the code and reducing the package size.

Since the code fundamentally depends on this default value
anyway, we can clear the users localStorage when they decide
to go back to the default – instead of storing a "1" which
does the same as the default.

Change-Id: I2814a1e9269979918609162a508eeee6944d9e52
2021-04-08 11:57:52 +02:00
Thiemo Kreuz c5accc0300 Rename many functions and files for clarity
The main motivation here is to dramatically reduce the number
of places that use the same property name "enabled" for values
on different objects (e.g. "state", "actions", and "updates"
are all different things) with slightly different meanings. I
tried hard to come up with names that reflect better what each
meaning is.

Bug: T277639
Change-Id: Ie766259793f716262e3d4622ca55156d11f4842c
2021-04-08 11:04:02 +02:00
Thiemo Kreuz 1f052e0dcb Make syncUserSettings support dot-separated paths
… instead of only 2 hard-coded nesting levels, as it was before.

This is done in preparation for splitting the "enabled" flag into
separate ones for each popup type. This patch here doesn't change
any behavior or internal representation of the states.

Bug: T277639
Change-Id: Icad669d1c9675ad6de22f478e254debe5d1936d7
2021-04-06 17:46:21 +02:00
Translation updater bot 941b5e156d Localisation updates from https://translatewiki.net.
Change-Id: I3414a093fb1c816ba4099b6d78e91f9e9fe756a8
2021-04-06 12:03:06 +02:00
jenkins-bot cc1ba5b82a Merge "Add title attribute to settings gear icon" 2021-04-02 19:57:18 +00:00
Clare Ming 4908f82c01 Add title attribute to settings gear icon
Add message, description, extension for title. Update createPagePreview, renderPagePreview methods to add title attribute to settings gear icon. Add test for title attribute. Increase maxSize, maxAssetSize, maxEntrypointSize. Add compiled js files.

Bug: T274887
Change-Id: Ibb29deb3418569d8283b954b4b22074423e78bda
2021-04-02 13:30:07 -06:00
Translation updater bot 90f40f6526 Localisation updates from https://translatewiki.net.
Change-Id: I85314a52614db07b1dd78275ebf7a0648ad8aedb
2021-04-02 09:49:16 +02:00
Translation updater bot 57f3814a0b Localisation updates from https://translatewiki.net.
Change-Id: I31ef156d9ad578660d8f891ac599e6b16a16e635
2021-04-01 08:37:55 +02:00
jenkins-bot 5ded058c42 Merge "Fix popup footer covering reference content" 2021-03-31 07:26:05 +00:00
Translation updater bot d252f4c35d Localisation updates from https://translatewiki.net.
Change-Id: I3245065dc8521312698503279d25baee6ba53702
2021-03-31 08:36:24 +02:00
Translation updater bot 9b0d811265 Localisation updates from https://translatewiki.net.
Change-Id: I254917097a6fd7c4acb94a37024abc7fb70e8341
2021-03-30 08:33:29 +02:00
jenkins-bot ebe316d3f3 Merge "styles: Remove obsolete vendor prefixed properties" 2021-03-29 20:06:25 +00:00
Andrew Kostka e4e07e509a Separate page and reference preview preferences
Bug: T277638
Change-Id: I8144625e0d3a2626511f35d4e92d082b6fa44bb4
2021-03-29 14:09:27 +02:00
Volker E 75cbbd67e6 styles: Remove obsolete vendor prefixed properties
Bug: T278670
Change-Id: Icd4d12fdd16d9a9630c755b50c93f0f417fa3d85
2021-03-29 02:36:43 -07:00
Translation updater bot 6144e315ee Localisation updates from https://translatewiki.net.
Change-Id: I2ee36fb5ece1aaa83b79760ef6966ef09afd1bae
2021-03-29 08:36:55 +02:00
Andrew Kostka 76e0b7ed3d Fix popup footer covering reference content
Links at the end of reference previews were covered by the footer
which made them unclickable.

Bug: T277364
Change-Id: I66313a282f24fd45804574577d8e071572de92b6
2021-03-26 16:49:03 +01:00
Translation updater bot 091b7aae59 Localisation updates from https://translatewiki.net.
Change-Id: I03ea5eb3306e3cdc51b74c7e632ecf53358705e9
2021-03-26 08:50:42 +01:00
Translation updater bot 13ea6453f5 Localisation updates from https://translatewiki.net.
Change-Id: I282a02ebabd53787ac375e5309f1f8c08e791c8c
2021-03-25 08:41:29 +01:00
Andrew Kostka 9a7539391f Messages for a separate reference previews preference
Bug: T277638
Change-Id: I8294cea7f8677b8ff09ce7deff3e69ed6e6ea93a
2021-03-24 10:25:56 +01:00
Translation updater bot 048bcd291f Localisation updates from https://translatewiki.net.
Change-Id: Ia3f246bd3d64cde4324b52a254ca000dd9c005d3
2021-03-23 08:25:23 +01:00
Noam Rosenthal e4ee4ed5cf Set thumbnail width to 215px
When it was min-width: 215px, it could sometime
grow and break the popup's layout.

Bug: T276668
Change-Id: If88887920c48c0a7f6530d1a7600f25fd2a9579b
2021-03-22 14:40:27 -07:00
jenkins-bot f58518e3ed Merge "Add tests for bitmask code" 2021-03-19 10:19:17 +00:00
jenkins-bot 7acef1f1f4 Merge "Use flags to represent settings" 2021-03-19 10:19:14 +00:00
Translation updater bot 5964b33f46 Localisation updates from https://translatewiki.net.
Change-Id: Ic962c35f646d98d679d87a0c3c075416d2716cb7
2021-03-19 08:26:07 +01:00
Translation updater bot 626778db8b Localisation updates from https://translatewiki.net.
Change-Id: Iff3b8f0d6ac077a2e33d9b175249d7fb10438cc4
2021-03-17 08:25:46 +01:00
Translation updater bot 23a116ddf7 Localisation updates from https://translatewiki.net.
Change-Id: I695783192f9c89effb3fadadc53a55757ae15954
2021-03-15 08:41:19 +01:00