Commit graph

206 commits

Author SHA1 Message Date
jenkins-bot 058c772d52 Merge "Restore the original behaviour of Reference Previews" 2024-06-24 07:07:44 +00:00
Jon Robson 79211c23ac Make generic preview icon display in night mode
Remove the ext.popups.images module, replacing it with
references to the SVG image.

- The footer image is the same in dark and light mode so use
background image
- Use mask image for sad face to make it work correctly in dark mode.
- Rely on CSS Janus for the ltr to rtl swap out

Change-Id: Idf041730549b834126d9631ac95611526ae5daa3
2024-06-14 00:55:53 +00:00
Func ff30b0bc2b Restore the original behaviour of Reference Previews
Commit a75ddc41 and 33f9e9d3 effectively changed the default user
option value of popups-reference-previews for users created before
2017/08/16 without any justification.

Please see the task description for full analysis.

This partially reverts commit a75ddc41.

Bug: T366419
Change-Id: I68d6114384af6d259dbc4541522d52ae9a289e49
2024-06-08 04:26:40 +08:00
WMDE-Fisch 1912475dae Remove most ReferencePreviews related i18n messages
The keys belong to the Cite extension where they are used already.

Bug: T363156
Depends-On: I788c16c5bddc0df7f00dbbc39625b9adaa5bf184
Change-Id: I1205af0539d6b2693f0e96d70393e7ecb005b7ba
2024-06-04 10:48:54 +02:00
Jon Robson aed5a78d6a Use strings rather than integers
Follow up to Iae454e4b4704a0289ca0a2b0794730562fda0dd1

Bug: T364347
Change-Id: I152af4bced8275fd9ae83d056550106e59f34815
2024-05-29 16:02:56 -07:00
Moh'd Khier Abualruz a75ddc4173 feature(Popups): Conditional User Defaults Implementation
Implement conditional defaults for user preferences in the Popups
component.
This patch aims to simplify the preference management system by
leveraging conditional logic directly within the component rather
than relying on multiple hooks

Changes:
- Updated `extension.json` to reflect the removal of outdated hooks.
- Updated `extension.json` to reflect the conditional user defaults.
- Removed unused user option `popupsreferencepreviews` from
 `extension.json`
- Modified `PopupsHooks` to streamline the preferences management,
 and depend on conditional user defaults, and removing `onUserGetDefaultOptions` and `onLocalUserCreated` hooks.
- Removed unneeded test cases in `PopupsHooksTest`.

Bug: T364347
Change-Id: Iae454e4b4704a0289ca0a2b0794730562fda0dd1
2024-05-28 21:05:57 +00:00
jenkins-bot 0d73ca0d80 Merge "Remove deprecated copy of referencePreviews module" 2024-04-16 09:45:12 +00:00
bwang e6fdaf1648 Replace codex-search with codex module
Bug: T356690
Change-Id: I1b90cb8847d85a5c761db573c94bec321bbb638a
2024-04-15 15:04:25 -05:00
Adam Wight da29c0299b Remove deprecated copy of referencePreviews module
This has been provided by the Cite extension since I0dc47abb59a4 .

Bug: T362332
Change-Id: Ic2594d0638685326fd08198c691e18371e132ffc
2024-04-15 10:44:48 +02:00
Fomafix 1ce8b38f9f Inject 'Popups.Logger' into PopupsHooks
The function PopupsContext::getLogger is not needed anymore.

Change-Id: Ib538372f1480d282857d827fedbe0ebe9abc0685
2024-03-19 20:26:53 +00:00
Fomafix a523b79232 Inject Popups services into PopupsHooks
Change-Id: I16ebb2aff9afab0449e3cc4b58a7ac6b3ed9870a
2024-03-19 20:10:36 +00:00
Jon Robson 7172aae082 Reference previews should no longer use Webpack
As a precursor to moving this code to the Cite extension move it off
of webpack and switch to using require rather than import

Bug: T355194
Change-Id: Ib6486ad38b79a3b67a9744b716b1a2f5d3779795
2024-02-02 10:52:30 -08:00
Jon Robson 381f8f5f7d Reduce bundlesize of reference previews by making it use stable APIs
This is a precursor to moving the code out to the Cite extension.

This can be squashed into parent commit or merged at same time.

I've kept the two patches separate to make them easier to review.

Bug: T326692
Change-Id: I50dbf28a1078df6c73fd0fbf77480488dd82c7b3
2024-01-16 11:44:07 +01:00
Jon Robson 59c6b8e88f Reference previews should use Popups registration
* Adds a new webpack entry point for references previews
* Reference related code in src/index.js is moved to new
file resources/ext.popups.referencePreviews/index.js

The changes:
* References previews now in its own module ext.popups.referencePreviews
* Loaded via getCustomPopupTypes
* OWNERS.md files make clear which team owns which part of the code.

Bug: T326692
Change-Id: Iea8a5b9221c0b1fd41e40bff2cbe01e42124d53f
2024-01-16 11:38:08 +01:00
James D. Forrester 2ef5278784 extension.json: Drop 'es6' flag, always true since MediaWiki 1.41
Change-Id: I6f8b1ce80138a98037ac245b2dc551c5e9167349
2024-01-12 19:04:39 -05:00
Fomafix a333160955 Use namespaced ResourceLoader classes
The old class names are deprecated since 1.39.

Change-Id: I8a317a9fdb4ee0208e55e364e3e8c3817419d5b1
2023-12-03 19:56:28 +00:00
Jon Robson 5abc2eed4c Cleanup: Remove non-functional hook
This doesn't work and Popups is not part of the
MediaWiki Language Extension Bundle

Change-Id: I66166ba964fba3a9ece865b701a95b66a924b9b6
2023-11-29 23:40:25 +00:00
gerritbot 96cea43fe1 Update UserOptionsManager's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Icb39d3f73e120fd0d9dad5ae362787cd19d47bfb
2023-11-29 12:55:13 +00:00
WMDE-Fisch b218a77ca4 Remove all BetaFeature code from ReferencePreviews
The extension is out of beta and will be enabled by default now.
Leaving some hints if we decide to also remove the feature flag.

Bug: T282999
Bug: T351708
Change-Id: I1556b2f3592294d094770ede2c276eddeef8bbe9
2023-11-24 13:07:46 +01:00
thiemowmde 7596165a5d Fix confusing constant names in PHP
The …AFTER_BETA constant is the one we want to keep after we removed
all BetaFeature code. The naming scheme is just confusing.

Safe to rename. Not used anywhere else:
https://codesearch.wmcloud.org/search/?q=REFERENCE_PREVIEWS_PREFERENCE_NAME

We also decided to keep the $wgPopupsReferencePreviews feature flag.
Update the documentation accordingly.

This is split from I1556b2f to make it easier to review.

Bug: T351708
Change-Id: Ifbb41156f2a5a4d8a81e79f613754869c5c89690
2023-11-24 12:51:41 +01:00
Jdlrobson 46d9c97180 Removing mw.ui.checkbox dependency (take 2)
This reverts commit af90386c67.

Reason for revert: The codex-styles module is now only loaded when
the settings cog is clicked.

Bug: T348069
Change-Id: I1d3c3a7b5c74c3e2d64765274468e48c014a4047
2023-10-27 16:46:40 -07:00
Jdlrobson af90386c67 Revert "Removing mw.ui.checkbox dependency"
This reverts commit 85d9a7b0ed.

Reason for revert: Unexpected visual change flagged by Pixel.
We're now loading BOTH codex search and Codex
styles on page load (the latter via JavaScript). This results in
a visual regression in the sidebar as the message box for
languages switches from MediaWiki UI to Codex. I am not 100% sure
what the right approach is here, but we should pause to assess
given this new learning.

Possible options
1) Add checkbox styles to codex-search bundle
2) Load codex-styles on page load instead of codex-search
3) Delay the loading of the codex-styles until the overlay is
rendering
4) Wait until Codex has code splitting.

Change-Id: I633364fea54b048492c6bde10b4c4cc8ab99b9ae
2023-10-27 21:59:46 +00:00
Jan Drewniak 85d9a7b0ed Removing mw.ui.checkbox dependency
wRemoves deprecated mw.ui.checkbox dependency
in favour of the `codex-styles` module.

Replaced checkbox markup in setting dialog accordingly.

Bug: T348069
Change-Id: I456a1c35cfc16703648c849917157258df67b224
2023-10-25 15:08:36 -04:00
bwang 154912e5db Rename icon classes in Popups to use popups-icon prefix instead of mw-ui-icon, replace resource loader icons with codex
Bug: T345653
Change-Id: I19b9861850064df50d6b88cda748feff6231091c
2023-09-12 10:56:53 -05:00
jenkins-bot 7e88a55e10 Merge "Replace mediawiki.ui.icon with Codex, update preview markup and styles to be more consistent" 2023-08-21 20:09:27 +00:00
bwang b78cfe50c9 Replace mediawiki.ui.icon with Codex, update preview markup and styles to be more consistent
- Removes .mw-ui-icon and .mw-ui-icon-element
- Aligns markup/styles between generic and disambiguation previews
- Update padding for generic and disambiguation previews to be the same as other popups, results in minor visual changes

Bug: T341899
Change-Id: I9a58fc6a93160d07452ea6f903e1797dd9421d92
2023-08-21 19:53:51 +00:00
James D. Forrester 30b5e96d53 build: Update MediaWiki requirement to 1.41
All extensions in Wikimedia production are expected to track MediaWiki's release directly.

Change-Id: I96d945aece8546af7037bd0758224f3fa67f6b11
2023-08-19 14:00:56 +08:00
bwang 6b659443b5 Update popups to use codex buttons over mediawiki.ui.buttons
- Provides missing accessible label for the settings button

Bug: T340256
Change-Id: I86972322ae34f1d1df8d79c66daa9e34091f9dd3
2023-07-10 16:03:36 -05:00
Jon Robson 428c32d027 Switch to native Promises and fetch
For fetch and AbortController we provide native polyfills (see
resources/src/skip-web2017-polyfills.js) so safe to use this here.
This will be empty for modern browsers.

Change-Id: Ic0f55eb0a0276be3587a4b866834bddff1124ad2
2023-05-12 21:34:42 +00:00
gerritbot 5775a5a37f styles: Replace 'mediawiki.ui/variables' call with skin variables
Replacing 'mediawiki.ui/variables.less' @import with
new skin-aware 'mediawiki.skin.variables.less' standard.
Also
- replacing several static values with new Codex design token featuring
  skin variables of `background-color`, `color`, `border-` and
  `opacity` category
- renaming three Less variables to variable naming standard

Please note, that this patch is not replacing all values with
possible Codex tokens. It's just applying them on selected
categories for consistency for now to keep the patch easier reviewable.
Further replacements will be done in follow-up patches.

Bump MediaWiki core required version to >= v1.41.0.

Bug: T332541
Co-Authored-by: Volker E. <volker.e@wikimedia.org>
Change-Id: If35605e8336c8619c6230bc892b360edbfd16f62
2023-04-13 05:31:50 -07:00
Jon Robson 11da8483f0 Remove targets definitions and limit page previews to ES6 browsers
I noticed that page previews is currently not working for ES5 users
as ext.maths.popups is an ES6 module which causes the
mw.loader call inside ext.popups/index.js to reject meaning the
feature never gets activated. This was broken in
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4.

I talked to Olga about whether we should restore ES6
support for page previews, and given the recent trend away
from IE11, we decided it made sense to drop page previews
support for ES6 users.

Bug: T328497
Bug: T329901
Change-Id: Icbd683b12c47491eba4de6b5a14afce4465553b9
2023-02-16 13:43:27 -08:00
Fomafix 76e2339cec Inject service UserOptionsManager in Hooks
Change-Id: I690699210c041f950a076904b863bc014833e5ad
2022-12-15 22:13:23 +00:00
Jon Robson 0febc3f54d Extensible previews
Allow extensions to register new types of previews via
extension attributes.

Changes:

- The check for reference previews doesn't make sense
as $('a[ href*="#" ]' ) will match any elements with a hash
fragment, so the additional check to Title.getFragment
will not provide a different result. This was introduced in
I9ec57e0fbb0d21beaaa7b359c1c2bef64d2c14f5
- Links that point to themselves are marked with mw-selflink
in MediaWiki so this can use the not selector we already have.
- The new API is used internally and only available via extension
Attributes
- An example is provided in SkinJSON
(https://github.com/jdlrobson/mediawiki-skins-skinjson/pull/14)

Bug: T233099
Change-Id: Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
2022-11-22 08:45:27 -08:00
jenkins-bot 723053f98a Merge "Revert "Use null for default user options value of beta features"" 2022-05-11 03:21:17 +00:00
Func 03ea5adb03 Revert "Use null for default user options value of beta features"
This reverts commit addb8a02d7.

Reason for revert: Not ready to be merged

Change-Id: Ia16b232e863c1aca490de44835b8790ce4516cc7
2022-05-10 12:32:14 +00:00
jenkins-bot 2eac3b36c0 Merge "Use null for default user options value of beta features" 2022-04-08 11:48:03 +00:00
Func addb8a02d7 Use null for default user options value of beta features
The new soft auto-enroll logic of BetaFeatures requires user options
default to null or no default values since it needs to save opt-out
values.
Unfortunately, BetaFeatures can't maintain default options itself, since
the GetBetaFeaturePreferences hook is coupled with User, can't be run
in the handler of UserGetDefaultOptions hook.
All the user options will be handled by BetaFeatures carefully, no
unnecessary values will be saved (no regression of T291748).

Needed by change I93af61153ec3c2cd3ec7686fe88067eed6766b5a, and they
should be merged in the same deploy train.

Bug: T260870
Change-Id: I1e9a91eed2e2eb22ce42f8d79b7183c505f1df7d
2022-02-01 11:53:03 +00:00
Fomafix cfa0f5419b Use HookHandlers and implement hook interfaces
This change requires MediaWiki 1.35+.

Bug: T263353
Change-Id: I4d3aa20c666799e6e693a6a4b7a3e835303e2fc5
2021-12-20 11:05:19 +00:00
Adam Wight 6bb27111e6 Update eventlogging schema
We've been dropping events for some time now.

Bug: T297523
Change-Id: I47567e227f69714dfdcf21f9c11d08067c4ca2e6
2021-12-15 14:45:14 +01:00
Umherirrender 9d7c3a9851 Add preference popups-reference-previews to DefaultUserOptions
Without the default the preference is never deleted from the database,
even it was disabled by the user.

Bug: T291748
Change-Id: I63ef1bad22acc4581e7c6aecb7dcc3d54422af18
2021-09-29 10:42:09 +02:00
Sam Smith 88edf5d999 virtualPageView: Log VirtualPageView events to Event Platform
We started logging VirtualPageView events to the Event Platform in
I645a81a4 but I640ab367c overwrote that change.

Change-Id: I3fcb9b79931da2ce0fa39ffc3be03e141d0d4152
2021-08-11 20:43:18 +01:00
Sam Smith 8f5000f346 Remove Popups instrumentation
Bug: T267211
Change-Id: I640ab367cd235ab8da7dd70dbef7ae9076712e84
2021-07-29 17:01:01 +00:00
Fomafix 197f7f557e Bump to requires MediaWiki >= 1.34.0
c7595e54f6 changed to
mw.util.escapeRegExp included in MediaWiki 1.34.

Change-Id: Ibef8f95b80d71d26dcd69572ce3b98f43f2cbfc0
2021-06-17 06:16:22 +00:00
Marcel Ruiz Forns cf1b674665 Set default VirtualPageView version to Event Platform schema URI
This schema has been fully migrated to Event Platform.  Setting
this as the default lets us remove the mediawiki-config override
of this that is currently being used.

Bug: T238138
Change-Id: I645a81a4a22130ed6a442c055d6bf4e78160705f
2021-05-24 20:33:45 +02:00
Thiemo Kreuz 275a67c730 Make checkboxes use upstream mediawiki.ui.… styles
This does not fully solve the ticket, as these are not the
actual OOUI styles. But it's already much better than the
unstyled checkboxes before.

Bug: T281227
Change-Id: I9a5023482774c09aa73845ca6dfd1c4926f088e1
2021-04-28 10:37:07 +02:00
Svantje Lilienthal 3b6d9ccc9d Renamed settings local from simple to page
We changed the handling of the popup settings. They now contain popup types (pages and references). 
To not get confused with the old setting options (simple, advanced and off), 
we would like to rename the local for the simple setting to page. 
It should already contain the correct string.

Bug: T277639
Change-Id: I8847b890e9e31602277a92d82a188fcdd3eea855
2021-04-23 14:35:06 +00:00
Svantje Lilienthal 09c2c52945 Added popup types handling
We added reference preview as a checkbox the the
anonymous user settings. To handle both popup types
(pages and references), we changed the usage of
preview.enabled. We pass on all types as a map
inside preview.enabled. The footer link to edit the
settings will appear for anonymous users if at least
one type is disabled.

Bug: T277639
Change-Id: I860a1b35ac7749d8d0884575f6acb7186ad8e4d0
2021-04-23 12:14:23 +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
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