Commit graph

14582 commits

Author SHA1 Message Date
Jan Drewniak 2fc809dc17 Replace hardcoded colors with Codex design tokens
Replaces hardcoded color hex values with their equivalent
values from Codex, via the "mediawiki.skin.variables" system.

Bug: T366197
Change-Id: Ia929a1a8d6351222acb454c8ec750e920ae6d072
2024-06-07 14:40:07 -04:00
jenkins-bot 4b1622f68b Merge "getTargetDataFromHref: catch error if passed invalid URL" 2024-06-07 10:21:18 +00:00
David Lynch b10fb53f8c getTargetDataFromHref: catch error if passed invalid URL
Could trigger this by typing `https://` into the internal link
annotation inspector.

Bug: T366822
Change-Id: Ie58ded247dbfb6c001d8177953ea148cd82ec03d
2024-06-06 10:57:35 -05:00
Ed Sanders 0378be0f27 eslint: Remove no-op config
Change-Id: Ibacf810f0d31c0aada34d3c6ca84007db506017d
2024-06-06 16:36:51 +01:00
Ed Sanders 291844dbee build: Update stylelint-config-wikimedia to 0.17.1
Change-Id: I8e0f087ae3d2644df85a85791b9c49c09567c0f4
2024-06-05 18:47:49 +01:00
Ed Sanders a3d4388bc1 Follow-up Ic9fad12fe: Move .css file to .less
MWCategoryWidget was converted to LESS syntax but wasn't
moved in the previous commit.

Change-Id: Ifd3e6228b96872ba40fa6d8db1617fb65b781dc0
2024-06-05 18:40:36 +01:00
Bartosz Dziewoński cc096f1bb8 Fix "implicit-arrow-linebreak" ESLint violation
Change-Id: I61bbfb0762438927c0f7bd5b8e8bf1365861d909
2024-06-04 18:58:25 +02:00
jenkins-bot 81a1c990e0 Merge "build: Updating eslint-config-wikimedia to 0.28.0" 2024-06-04 13:53:03 +00:00
jenkins-bot 595db906cc Merge "MWExtensionDialog: Fix documentation of confirmAbandon" 2024-06-04 10:57:59 +00:00
libraryupgrader 702677220d build: Updating eslint-config-wikimedia to 0.28.0
The following rules are failing and were disabled:
* modules/ve-mw/tests:
  * implicit-arrow-linebreak

Change-Id: If857233c0de24c8cf619dbb1347ebb375f3ab1ba
2024-06-04 03:40:00 +00:00
Timo Tijhof ad6e0e332e MWTemplateTitleInputWidget: Fix unstable sort affecting Firefox
I'm going to assume the order in production with Chrome, as asserted
by the unit test, is the preferred order whereby negative numbers are
intended to be prepended before the positive numbers.

This came up in I6ecbd5743f3e, where this was the only unit test across
MediaWiki core and WMF gated extensions, that fails in Firefox.

It is reproducible locally with plain MW core + VisualEditor as well.

Bug: T366299
Change-Id: I6f8546e6e604cbb41e11bd2b59f8b5f19350c676
2024-05-31 17:12:29 +01:00
jenkins-bot 8e4d4959fc Merge "Avoid Array.concat" 2024-05-29 22:02:03 +00:00
Ed Sanders b9b966de6e Avoid Array.concat
See I9addf43b2857de7bcac.

Change-Id: Ic1998ab6f7dedf6946d7ae63a985a76031f8eecf
2024-05-29 21:16:25 +01:00
jenkins-bot 66c6fa294c Merge "Change confirmation behaviour when abandoning template edits" 2024-05-29 16:58:43 +00:00
jenkins-bot 28fae02c8b Merge "Tests: Use spread syntax on string literals" 2024-05-28 19:39:59 +00:00
jenkins-bot 48823cad4b Merge "JSDoc: convert @cfg to @param" 2024-05-28 15:13:20 +00:00
jenkins-bot f41d5740c1 Merge "Consolidate minor code duplications in DiffPage" 2024-05-28 15:12:39 +00:00
jenkins-bot c3204463de Merge "Remove redundant elements from Unicode-enabled regex" 2024-05-28 15:11:37 +00:00
Zoë 3c6f0a918c Change confirmation behaviour when abandoning template edits
Previously, it was possible to close a dialog with active edits by
pressing the "<" button or pressing escape. A change was made to confirm
the user's intent before abandoning their changes, see Ia8935b5b1acb

This patch fixes a bug where the user's intent is always confirmed while
editing a template, even if the user has made no changes. This was
because for technical reasons we trimmed whitespace before making a
comparison with the new template case, but that caused the comparison
with the edit case to always fail because existing templates are padded
with whitespace.

This could have been solved by moving the trim operation into the new
template flow. This patch would still have been necessary to prevent
a bug if the default value had trimmable whitespace. I have opted to
keep the whitespace behaviour for edits for consistency.

Bug: T334513
Change-Id: I7b3370c86df67c36fc63a1f1d0e7004a098a1950
2024-05-28 15:49:19 +01:00
Novem Linguae 9ffbfc77cd JSDoc: convert @cfg to @param
Bug: T250843
Change-Id: I53ef4fa4a65b017eec90cc1f2cbb7e7f0681e317
2024-05-26 21:59:02 -07:00
Ed Sanders 155549ab60 Tests: Use spread syntax on string literals
Because `...'Foo'` is more legible than `'F', 'o', 'o'`.

Change-Id: I09ac584ee79b8f89c48f135182e60d7fb1b54557
2024-05-24 22:23:42 +01:00
thiemowmde 3a7d345093 Remove redundant elements from Unicode-enabled regex
Same as in If6c7e85 in the TemplateWizard codebase. [a-z] is already
part of \p{L}, and [0-9] is part of \p{N}.

Change-Id: I8008ac7e504739b8f4b5fb5dd732b0deca20cefc
2024-05-24 15:47:02 +02:00
thiemowmde e867a49a69 Consolidate minor code duplications in DiffPage
Change-Id: I4969616c75cf201dde1094715ccbb796a92c1d92
2024-05-24 15:45:20 +02:00
thiemowmde c3953814e4 Fix typos and outdated links in comments
That property in the magic word class doesn't exist any more.

Change-Id: Ife275944bd1c8dec603bd01dea6075ad36acf59e
2024-05-24 15:40:01 +02:00
Ed Sanders cb657e0bdf ESLint: Re-enable prefer-const and fix
Change-Id: I9dbc12335016a326f00bf5b9a960551f828c685d
2024-05-21 17:50:12 +01:00
Ed Sanders dbc696124f ESLint: Enforce no-var and autofix
Temporarily disable prefer-const as this requires
manual fixing.

Change-Id: I477b69a57e8d33535c6fc71dba196a8605780725
2024-05-21 17:40:52 +01:00
Ed Sanders 064a30b911 MWExtensionDialog: Fix documentation of confirmAbandon
Change-Id: I30b13f524d97e098d7ce0ae374e452871e500770
2024-05-17 15:53:26 +01:00
jenkins-bot cec87f4ba1 Merge "Use codex tokens for .mw-editsection-bracket" 2024-05-16 15:54:15 +00:00
jenkins-bot 22e6758092 Merge "tests: Adopt QUnit.test.each() and native async-await in a few places" 2024-05-16 11:32:29 +00:00
Sohom 22d25a48d2 Use codex tokens for .mw-editsection-bracket
Bug: T365089
Change-Id: I21ab4016dd38811501684867a41c3de3b9a342df
2024-05-16 00:54:42 -04:00
Novem Linguae 3d96eedbee eslint: remove redundant ruleset wikimedia/jsdoc
The ruleset wikimedia/client-es6 already contains
the ruleset wikimedia/jsdoc. So wikimedia/jsdoc
doesn't need to be declared.

Bug: T365047
Change-Id: Ibc13c9bf4bbbe36d5c8296372f59cc13a0c0940b
2024-05-15 18:38:53 +00:00
Ed Sanders 2615070b42 Convert function to arrow function to fix context
Bug: T364783
Change-Id: I02100e193554fa359b7be2c52d1ee67f63734a2d
2024-05-13 22:31:00 +01:00
jenkins-bot 6f307830af Merge "ArticleTarget: Fix return of getVisualDiffGeneratorPromise" 2024-05-10 20:34:01 +00:00
Ed Sanders b247c70a22 ArticleTarget: Fix return of getVisualDiffGeneratorPromise
The promise is supposed to return a function that can be used
to lazily generate the visual diff, not the visual diff itself.
This was broken when switching to arrow functions.

Bug: T364635
Change-Id: Ifa971333aa22af346bb62d031dc20afc8979992c
2024-05-10 20:09:09 +00:00
jenkins-bot bd1c1593a7 Merge "Fixes incorrect transition from searched image preview to upload panel" 2024-05-10 14:06:04 +00:00
Zoë 220088e13e Fixes incorrect transition from searched image preview to upload panel
This line was introduced by If59979f.

This action is only invoked from the 'safe' action when the dialog mode
is 'info' - uploads are under 'upload-info' instead - so I believe we
shouldn't end up here from an upload and whatever condition this was
guarding against is no longer a concern.

Bug: T362015
Change-Id: I6a6551eab3fb698a6ae781be4623b48e4b4c7edb
2024-05-10 10:57:11 +01:00
jenkins-bot f95f6768fc Merge "Disable eslint security regexp warnings" 2024-05-09 16:33:35 +00:00
Ed Sanders 1980827aec Use arrow callbacks in other modules
Change-Id: Ib07720923de6657ae55ac29a07c5cc85b088a70d
2024-05-09 10:33:44 +01:00
Ed Sanders a5de8d5653 Convert local functions to arrow functions and remove this bindings
Change-Id: I7987de8737103a1fc568944496c4d707dde60bc3
2024-05-09 10:33:44 +01:00
Bartosz Dziewoński 12613a6ad0 Disable eslint security regexp warnings
They generate a lot of false positives in this extension.

Since this is client-side code, the worst that could happen is a
browser tab hanging, not any real security issues.

Change-Id: I177cfa7e57a6b7b528d558d2cba076e85fd0271f
2024-05-07 20:54:42 +02:00
Amir E. Aharoni 3ab0128bfd Parse a message correctly
Follow-up to
I2495fe32c2d540be50450d715b049173f2f8727d

Done with the help of Matma Rex at Wikimedia Hackathon 2024.

Bug: T361103
Change-Id: Ica328233cb6172277e66d2341cfb53f87f8aff67
2024-05-07 12:06:37 +00:00
jenkins-bot 6bdd8e21a3 Merge "Fix displaying of "<Invalid>" when an language code isn't found" 2024-05-04 14:48:12 +00:00
jenkins-bot 8f75500ef7 Merge "Fix media dialog layout." 2024-05-03 23:23:17 +00:00
Ed Sanders acd075a4d7 Fix displaying of "<Invalid>" when an language code isn't found
Bug: T361109
Depends-On: I1e85a9d41c017fc3e3897b8b69177f342c5a43ef
Change-Id: I2ef072c3265fa9477ca2be539a7084454a8d8cae
2024-05-03 17:38:14 +01:00
Ed Sanders eb757c4c9f Remove unnecessary context binding when using arrow functions
Change-Id: Ie25e90aeb0519b1e0f793348b27d4d4a6b686698
2024-05-03 12:47:47 +01:00
jenkins-bot 8a35d3cf83 Merge "JSDoc: {Mixed} -> {any}" 2024-05-02 18:20:12 +00:00
Zoë f0cef27552 Fix media dialog layout.
Restored a selector lost in Ic9fad12f

Bug: T363992
Change-Id: I68b3052665db6ad09c594debbc593b11b7edebff
2024-05-02 18:59:29 +01:00
Ed Sanders 29e42695e4 Follow-up Ifdb15ea9: Restore deleted 'new' keyword
Change-Id: I6cd6a617ae63347df1a2b7de111cac6860950cf3
2024-05-02 12:28:51 +01:00
Ed Sanders 673dea4852 JSDoc: {Mixed} -> {any}
Change-Id: I457475a9c436c40a384675027c052294e6b1305d
2024-05-02 10:39:25 +01:00
Timo Tijhof 6cbedbf9d2 tests: Adopt QUnit.test.each() and native async-await in a few places
* Remove need for manual hacking of sub groups via "msg" strings
  carefully prepended to every assertion.

* Improve CI details, by reporting the specific case that failed,
  and local dev via ability to re-run each case, and reporting names
  directly in the HTML Reporter and CLI summary.

* Reduce need for assert.async() and tracking of callbacks, especially
  to improve failure details in case of Promise rejection.
  Current logic was likely to cause a confusing timeout instead of a
  clear failure if the promise ends up rejected.

  QUnit propagates these as part of awaiting and asserting the test
  closure's promise value (as async fn) automatically.

  This approach also avoids the pitfal of a falsely passing test
  when an assertion inside a done() handler was never reached.

* Use modern for-of where possible to remove need for closures and
  arrow functions. Thus reducing complexity of test code, where
  complexity should be kept lowest to avoid false confidence.

* Use plain for-in instead of overly complex Object.keys().forEach().

Change-Id: I934a266e75e64371081f104cfb867fb2c282c84a
2024-05-01 19:01:19 +01:00