Commit graph

125 commits

Author SHA1 Message Date
Jon Robson 9b9a7ff739 Monitor bundle size of module added on page load
Bug: T360590
Change-Id: Icdd1e38fc6d4015a37a3adccdf6b18ee0c54b687
2024-09-17 20:51:33 +00:00
Fomafix fb573fdb2b Use UserFactory::newAnonymous instead of deprecated User::newFromId
Change-Id: I4ae99f1118ce23708a07b0dcc69ddba248dafb9f
2024-09-07 12:51:06 +00:00
Adam Wight 7a79602208 [cleanup] Remove unused configuration $wgPopupsReferencePreviews
This configuration is always enabled, so remaining conditions are dead
code.  Removing the flag in this code base simplifies moving the
remaining Reference Previews settings in a later patch.

Bug: T363162
Change-Id: I2b952f4203b6ffa040daad2aa288eb53d2ffd3b2
2024-09-05 20:26:31 +00:00
Fomafix bdf44ea4f7 Use overrideConfigValue/overrideConfigValues instead of setMwGlobals
Also use MainConfigNames.

Change-Id: I8014b6ca5fdf79c98da05981967d98bbbbaeef98
2024-07-29 20:24:01 +00:00
Fomafix 7e3a444a99 Use service 'GadgetsRepo' instead of deprecated GadgetRepo::singleton()
The service is optional to support with and without extension Gadgets.

Change-Id: I41d1516e185ceb5c49b38361360a3adad1a333de
2024-07-03 07:19:28 +00:00
Fomafix c973491965 PopupsContextTestWrapper: Remove null check for $gadgetsIntegration
$gadgetsIntegration can never be null. This is ensured by the PHP type
check.

Change-Id: Ia70e8b8b329ba771dcb8a98d4a78220c2f0f5fbf
2024-06-29 20:41:43 +00:00
jenkins-bot 058c772d52 Merge "Restore the original behaviour of Reference Previews" 2024-06-24 07:07:44 +00:00
Umherirrender 12a86a9e49 Use namespaced classes
Change-Id: Iaa28a15e8bc1ea29e302aa2180dec0bf67f5817e
2024-06-09 19:14:49 +02: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
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
thiemowmde 1e61af1798 Use more trivial HashConfig in tests
No need to mock this.

Change-Id: Ic312fd6045e4c6ea450114f3548596481f1fd2ee
2024-04-24 13:13:13 +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
Umherirrender f3c4642fd5 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ib30da35841aadb558709dbbe6e30be2241048c87
2024-01-05 22:41:45 +01:00
jenkins-bot cdede23c59 Merge "Update tests for PHPUnit 9.6" 2023-11-30 23:08:24 +00:00
jenkins-bot ea42009239 Merge "Update UserOptionsLookup's FQN" 2023-11-29 17:14:37 +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
gerritbot 031ace2dba Update UserOptionsLookup'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: I0c66220b0ba9501e8ef20a172d21d7e75a19d6cc
2023-11-29 12:39:47 +00:00
Daimona Eaytoy d77b6e9992 Update tests for PHPUnit 9.6
- Avoid withConsecutive()

Bug: T342110
Change-Id: I3f07a2f071ddec3f9bbd147b8bfc0d32277203d6
2023-11-27 03:13:29 +01: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
gerritbot 2da869fa58 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: Ia3b739ceacc035d64ec6d13de9d3e6de102dbb20
2023-08-19 12:22:49 +00:00
Daimona Eaytoy c581aab15e Avoid using TestUser in non-Database tests
TestUser is expensive and requires DB access because it creates the user
in the test database. That is not needed here. For these tests, a mock
is enough.

Also make PopupsGadgetsIntegrationTest an integration test, to fix a
local failure and in view of I0a04c82250582fed7a66c1e10868d9b4f3823a28.
If a test is testing the integration of X with Y, guess what, it's an
integration test ;-)

Change-Id: Ie8b3376ce97b9ddc67746f7754b92628c5ab9470
2023-08-10 00:08:49 +02:00
Umherirrender 9da6586158 tests: Make PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: I1a585a5e81ad0355b3be806da249e632f3fd21ec
2023-05-20 13:56:14 +02:00
Fomafix 76e2339cec Inject service UserOptionsManager in Hooks
Change-Id: I690699210c041f950a076904b863bc014833e5ad
2022-12-15 22:13:23 +00:00
Fomafix c58f9234fc Use $this->getServiceContainer() in test cases
Change-Id: Ic03f4d692720cd9810c44700f7bf27d1cf07d26d
2022-11-05 09:50:56 +00:00
Fomafix 56d8a8df55 Inject service SpecialPageFactory
Change-Id: Ia38b468741bdfd5bab5bb34df79bf01d549498a9
2022-11-05 09:28:08 +00:00
Thiemo Kreuz dd3bff0d2a Use PHPUnit's convenience shortcuts where possible
Change-Id: I5cc75a66f5971de409a9debdd4f4ebfb8ee94b22
2022-09-29 14:41:35 +02:00
Reedy 3ac384e5a5 PopupsGadgetsIntegrationTest: Use namespaced Gadget class
Change-Id: Iad6488408fdd29af45dab46e1c81944d181f711d
2022-03-29 20:37:32 +01:00
Reedy b6eb2627ff Use namespaced GadgetRepo
Change-Id: Ibaa24dc0bf02b0d1cbe4e66a8a4efc47896d0fb9
2022-03-06 01:33:08 +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
Alexander Vorwerk 131186d8b8 MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: I1cb26373fb173c5abf7c3838185b68016e4ade05
2021-10-12 01:00:04 +02:00
Sam Smith 8f5000f346 Remove Popups instrumentation
Bug: T267211
Change-Id: I640ab367cd235ab8da7dd70dbef7ae9076712e84
2021-07-29 17:01:01 +00:00
Alexander Vorwerk 35462639c3 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with
UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: I9a2118a6342bd5f145174428dcfb518cba4e439b
2021-06-06 16:44:20 +02:00
anjali041 81bb920e2b Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: I5698b4422755a921c9c9c01ce29084ebfe5f5385
2021-06-02 12:21:10 +00:00
Thiemo Kreuz 3a00223a36 Separate reference preview settings in beta & non-beta
This is the smallest possible patch for a backport.

While it seems there is zero technical reason to limit user
option keys to lowercase with dashes, it's best-practice.
Same as message keys.

Bug: T281235
Change-Id: Ia4a45cf4459543c81b23b757ae9c2cfaf9676894
2021-04-27 16:15:17 +02:00
Thiemo Kreuz e19b557227 Merge duplicate ReferencePreviews Beta feature flag
Change-Id: Ia7f1c9128460bc5a139e37eb16fff649e80cd20f
2021-04-21 10:46:05 +02:00
Andrew Kostka e4e07e509a Separate page and reference preview preferences
Bug: T277638
Change-Id: I8144625e0d3a2626511f35d4e92d082b6fa44bb4
2021-03-29 14:09:27 +02: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
jenkins-bot e441052cb0 Merge "Combine page and reference preview preferences" 2021-03-01 11:10:17 +00:00
Umherirrender eaaf560d99 build: Updating mediawiki/mediawiki-codesniffer to 35.0.0
Change-Id: Ib411b8fbec93f469e4f4812f60f8349207744ecd
2021-02-26 23:42:29 +01:00
Andrew Kostka 82d54945e4 Combine page and reference preview preferences
Update copy and remove unnecessary reference preview preference
in favor of using the default preference. It seems there is no
stable method to link to the subsections on the preference page
for gadgets. So in all cases does the link just point to the
gadgets pref page.

These changes should only be visible when reference previews
are no longer marked as a beta feature.

Bug: T265709
Change-Id: I7b8ab91331092ada04b230315373548673b9272c
2021-02-25 10:21:16 +00:00
Svantje Lilienthal 1962372a44 Add cogwheel to disable ReferencePreviews
I added the common styling for the setting icon to the popup.less
and removed the now empty pagePreview.less.

Bug: T234205
Change-Id: I2a82831bc71a4208c4b66c18e2a4613127c43e1f
2021-02-16 15:39:43 +01:00
Vedmaka ff2ba9ebf5 Adds "$wgPopupsTextExtractsIntroOnly" option to control "intro" parameters for TextExtracts API request
Change-Id: I84f91ab0752bbd4a5b1ee159b7cbe1388f942f24
2020-12-07 15:00:29 -08:00
Svantje Lilienthal 0b6c859a2b hide reference previews when reference tooltip gadget is active
Change-Id: I5f43270bfeba944c05dc09adf771ed07057237c7
2020-11-16 18:36:04 +01:00
Ammar Abdulhamid 5e405eb2f2 Popups: Rename new config variable
In this patch we introduce a new config variable and update its default
to be the same as the production value of $wgPopupsPageBlacklist.

When this code is deployed everywhere, we will remove wgPopupsPageBlacklist
from mediawiki config and defer to the Popups extension as the source of
truth from now on.

Bug: T254676
Change-Id: Ifebdcf8f5eec854a2b947dc390eaf47704a5c5eb
2020-07-07 09:47:59 -07:00
Thiemo Kreuz 092e2a4959 Talk about "exclusions" instead of "blacklists"
AVoid the term if possible, in all internal code. The only remaining
use of the word is in the public $wgPopupsPageBlacklist config
variable.

Change-Id: Ib238731270f473ad44fcff13df617a70433f2452
2020-06-09 08:56:06 +02:00
DannyS712 48f3a8f720 Remove unneeded ::setUp and ::tearDown methods that only call parent
Change-Id: I2700613e5071bc20ef8ed9706de70e596cdfdbc7
2020-06-07 03:10:11 +00:00
DannyS712 68d52f7fa9 Use assertTrue instead of assertSame to compare with true
Bug: T244552
Change-Id: I42c50e37515e49a15658041147edc1d644812c46
2020-02-07 07:17:04 +00:00