Commit graph

2640 commits

Author SHA1 Message Date
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
Translation updater bot 9aa779ba35 Localisation updates from https://translatewiki.net.
Change-Id: I1c8e248dd40abbfe876b03ad776f062da44ab39a
2021-03-12 08:46:38 +01:00
Thiemo Kreuz e1ca9e940e Fix bottom margin as long as settings icon isn't shown
The bottom margin appears significantly smaller in popups that
open to the top. This is because the triangle ("pointer") falls
within this margin, not outside of it.

This is only temporary. Later the settings icon will always be
there, and the issue is gone.

Bug: T276200
Change-Id: Ic0f0447b8fbd3e6ff7035bdc9380c19a236f091c
2021-03-11 19:30:39 +01:00
WMDE-Fisch 97538eb9e1 Add tests for bitmask code
Bug: T276716
Change-Id: I7c21e909f121217e43bf5072061bda422f390693
2021-03-11 14:05:21 +01:00
WMDE-Fisch 58f820009e Use flags to represent settings
To reduce size of code added to the <head> and increase performance.
The increased bundlesize is still less than the size spared bytes in
ResourceLoaderGetConfigVars. - But nevertheless the main gain is loading
less in the <head> anyways.

To avoid further complexity in the code, the bitmask is converted to
the according config setting early on instead of adding checks on the
bitmask all over the place.

Tests will be added in follow ups.

Bug: T276716
Change-Id: Ib4f82bed58295b25f0a41cb37e36244e45f16317
2021-03-11 13:38:06 +01:00
Translation updater bot 91d308ab6f Localisation updates from https://translatewiki.net.
Change-Id: Ia9902b85628e6ea9342d3fa3ddc42640aa1442a1
2021-03-11 08:38:25 +01:00
Translation updater bot 0a9b70f3fe Localisation updates from https://translatewiki.net.
Change-Id: I4d622ecd920c634fe7a7db1e11a87afe2355c71a
2021-03-10 08:32:33 +01:00
Translation updater bot a0781d21e1 Localisation updates from https://translatewiki.net.
Change-Id: I9f84a52bcaa6e31f082625e579e1ff98fa467d10
2021-03-08 08:46:58 +01:00
Thiemo Kreuz 919a7a5a30 Don't use {{int:…}} in full sentence messages
Directly referencing other messages is sometimes a good idea,
e.g. in a sentence like "Please look for a button with the
label \"{{int:cancel}}\"."

But here the word is used as part of a sentence. "This is
really not great, because in some languages the word can
change according to grammar." (T276218#6886266)

This patch doesn't change the wording of the messages, and
should not need PM approval. The qqq.json entries are
annotations for tranalators and don't need PM approval either.

The only additional change is that I update the gadget's names
to be their canonical ones everywhere.

Bug: T276218
Change-Id: I8a05f3871fa1d5d0570e1cba90ead29f9ea3b7df
2021-03-05 16:01:00 +01:00
Andrew Kostka 9fcdaf5c00 Fix maximum height of reference popups when in beta
This fixes a small regression introduced in Ia61f1b7. When
reference previews are still enabled as a beta feature the
unnecessary footer is hidden, therefore, we need to account
for this when calculating the dialog's height.

Bug: T234205
Change-Id: I1c142019031ab954550e237ddb23824da1aee8db
2021-03-05 12:52:13 +00:00
Thiemo Kreuz 24c75d11b3 Fix maximum height of reference popups
In patch I2a82831 we removed a line `margin-bottom: 16px`. This
margin defaults to 47px now. This made the popup bigger. This
patch fixes this.

The original size of 403px was introduced in I6036968 (T246029)
and already fixed one time in I82ea489 (T246029).

Bug: T234205
Change-Id: Ia61f1b79f8450d6249e190ab4ed1565ed5ac77be
2021-03-05 11:50:21 +00:00
Translation updater bot 3dea2e3c81 Localisation updates from https://translatewiki.net.
Change-Id: I843fa42f0401c6921d117a293fdf283fe061d59a
2021-03-05 08:56:29 +01:00
jenkins-bot 189f3cb0a2 Merge "remove spacing, when the footer is empty" 2021-03-04 16:45:31 +00:00
Svantje Lilienthal fb0863f101 remove spacing, when the footer is empty
Bug: T276200
Change-Id: Id5d30a53251bdf3674388cbdb29d93a0d52b3266
2021-03-04 16:22:55 +00:00
Thiemo Kreuz 66b5e307e1 Minor tweaks to the wording of gadget-related messages
Bug: T276218
Change-Id: I6b9ebec33f39e938855c5ee9b2f9665ea92560d0
2021-03-04 09:53:41 +01:00