Commit graph

9 commits

Author SHA1 Message Date
jenkins-bot 29e8ba9ea0 Merge "Further delay search index build in ReferenceSearchWidget" 2024-04-30 10:49:17 +00:00
jenkins-bot 74b42ace80 Merge "Make ReferenceSearchWidget code a bit more functional" 2024-04-30 10:49:14 +00:00
WMDE-Fisch 179d402344 Add ReferencePreviews config checks to Cite extension
PHP classes and test are somewhat copies from the Popups codebase.
Some refactoring was applied. More could be done. Not to sure if
this should happen more in follow ups though.

Could also reduce the complexity of checks on the JS side. Most of
these things can only change on page load. The only dynamic part
left is the anon user setting managed by the Popups extension.

Note, that I needed to add a new PHP config for here although the
other still exists and is needed in the Popups extension. This
will change, when the user settings code also moves.

I guess it's okay for now though. Both settings default to true
and are not overridden in the config repos.

Also needed to add the Gadget extension as phan dependency.

Bug: T362771
Depends-On: Ia028c41f8aaa1c522dfc7c372e1ce51e40933a5e
Change-Id: Ie6e8bc706235724494036c7f0d873f5c996c46e6
2024-04-25 12:50:27 +02:00
jenkins-bot ca629c3dd1 Merge "Internal config variables renamed from Popups to Cite" 2024-04-22 16:01:31 +00:00
Adam Wight f0849b2b17 Internal config variables renamed from Popups to Cite
This updates the easy variables which are set and get within a single
module, these changes should have no effect and don't need to be
coordinated across extensions.

Bug: T362332
Change-Id: Ibbe69c321e9e2b744ec88cebbdc3476d776f5956
2024-04-22 14:31:55 +02:00
thiemowmde 203a1cde34 Further delay search index build in ReferenceSearchWidget
The search index is really only used in a single place, in the
buildSearchResults method at the very bottom of the class. I find it
more obvious to understand what's going on when the places where the
search index is populated and used are as close together as possible.

This again really only moves existing code around without actually
changing anything.

We can also drop the extra "built" property and use a special null
value instead. This is possible because we know the only consumer of
the this.index property and can guarantee it can't get confused by
the null.

Bug: T356871
Change-Id: Iaddb3b16b3aa776f89fca2bf0350cce9b6bb1a23
2024-04-04 15:13:50 +02:00
thiemowmde e9561ade15 Make ReferenceSearchWidget code a bit more functional
This turns two methods with side-effects into more pure functions
with more obvious input and output. buildSearchIndex rebuilds the
internal search index from the internalList. buildSearchResults
filters and creates the result widgets the user will see.

This patch really only moves existing code around but doesn't change
anything. Except that this.built is set before onQueryChange is
called, not after. This avoids potential endless loops in case
onQueryChange happens to trigger buildIndex again.

Bug: T356871
Change-Id: Ib80a2dcb85779d64bec53caf90c49879d0ea2258
2024-04-04 15:12:57 +02:00
thiemowmde b02028b671 Move ve-cite QUnit tests to top-level tests/ directory
It's just hard to find and confusing when hidden in that
sub-directory.

Bug: T358851
Change-Id: I19ffe73b79fa9add52af12f477afe7abbc6db836
2024-04-03 12:03:33 +02:00
Jon Robson dcb513eb0e Move reference previews to Cite extension
The ext.cite.referencePreviews module will transparently replace the
ext.popups.referencePreviews module after this patch.  Configuration
stays in Popups for now, we can migrate it in later work.

CSS classes may be renamed in the future but this will be handled
separately since it could be a breaking change for on-wiki
customizations.

A lot of fancy footwork happens in this patch to emulate a soft
dependency on Popups.  This mechanism doesn't exist explicitly in
either ResourceLoader or QUnit, so lots of workarounds are used, to
conditionally load the module and to dynamically skip dependent tests.

renderer.test.js is fully skipped for now, but can be wired up in
later work.

Bug: T355194
Change-Id: I0dc47abb59a40d4e41e7dda0eb7b415a2e1ae508
2024-03-12 17:43:51 +01:00