Commit graph

2135 commits

Author SHA1 Message Date
jenkins-bot b6e930a101 Merge "Change CommentParser into a service" 2022-02-20 14:01:11 +00:00
jenkins-bot ff6dbe0ed1 Merge "CommentParser: Remove unused method getThreadItemsByName()" 2022-02-20 13:45:06 +00:00
jenkins-bot c29c1eebd2 Merge "Split Data class into ResourceLoaderData and LanguageData" 2022-02-20 13:44:56 +00:00
jenkins-bot 4713986eb7 Merge "Various code quality tweaks" 2022-02-20 13:27:10 +00:00
Bartosz Dziewoński 4613ae78e7 Change CommentParser into a service
Goal:
-----
To have a method like CommentParser::parse(), which just takes a node
to parse and a title and returns plain data, so that we don't need to
keep track of the config to construct a CommentParser object (the
required config like content language is provided by services) and
we don't need to keep that object around after parsing.

Changes:
--------
CommentParser.php:
* …is now a service. Constructor only takes services as arguments.
  The node and title are passed to a new parse() method.
* parse() should return plain data, but I split this part to a separate
  patch for ease of review: I49bfe019aa460651447fd383f73eafa9d7180a92.
* CommentParser still cheats and accesses global state in a few places,
  e.g. calling Title::makeTitleSafe or CommentUtils::getTitleFromUrl,
  so we can't turn its tests into true unit tests. This work is left
  for future commits.

LanguageData.php:
* …is now a service, instead of a static class.

Parser.js:
* …is not a real service, but it's changed to behave in a similar way.
  Constructor takes only the required config as argument,
  and node and title are instead passed to a new parse() method.

CommentParserTest.php:
parser.test.js:
* Can be simplified, now that we don't need a useless node and title
  to test internal methods that don't use them.

testUtils.js:
* Can be simplified, now that we don't need to override internal
  ResourceLoader stuff just to change the parser config.

Change-Id: Iadb7757debe000025e52770ca51ebcf24ca8ee66
2022-02-19 19:51:57 +01:00
Bartosz Dziewoński f51f3a1051 CommentParser: Remove unused method getThreadItemsByName()
Follow-up to a5099739a6.

Change-Id: I53cbf6a7a2c9b95674998734689b3930dfe74149
2022-02-19 19:51:57 +01:00
Bartosz Dziewoński 99b5de8038 Split Data class into ResourceLoaderData and LanguageData
The Data class contained utilities for two unrelated purposes.
Split each half to a separate class.

Notably, this improves the signature of the getLocalData() function.

Change-Id: Icde615fb9d483fee1f352c34909b37f8ffde8081
2022-02-19 19:37:34 +01:00
Bartosz Dziewoński ae9f26a9e5 Various code quality tweaks
(suggested by PhpStorm)

composer.json:
* Document required PHP extensions

Parser.js:
* Remove incorrect param documentation
* Fix some typos in comments (missing parentheses)

CommentParser.php:
* Fix some typos in comments (missing parentheses)

ImmutableRange.php:
* Remove unused property
* Add a `throw` to indicate that code path is unreachable

SubscribedNewCommentPresentationModel.php:
* Add missing `return false`

CommentParserTest.php:
* Remove unnecessary pass-by-reference

CommentModifierTest.php:
* Remove unused variable

CommentParserTest.php:
* Don't construct Element objects directly. PHP's DOMElement allows
  it, but Parsoid/Dodo's doesn't, and we use the latter for static
  analysis. This generates all kinds of confusing warnings.

Change-Id: Ia9598ebea0e99830dd485296e94a9d96acc4b258
2022-02-19 19:36:52 +01:00
Ed Sanders d1e56c7dc5 ApiDiscussionToolsEdit: Pass useskin & mobileformat to ApiVisualEditorEdit
From there they are passed on ApiParse.

Change-Id: I8411379694961868c2540c42739fb4f5d7b61972
2022-02-18 16:40:38 +00:00
Translation updater bot 1df44c5102 Localisation updates from https://translatewiki.net.
Change-Id: I6e315a582403ccb25c6250c5d4f672c9c408ca36
2022-02-18 08:40:35 +01:00
David Lynch 7094cc592c Don't autosubscribe flagged bots
Bug: T301933
Change-Id: Icabee260a16ed2686a95250bad2aa1b92881566e
2022-02-17 11:54:14 -06:00
Translation updater bot 4f5293f5bc Localisation updates from https://translatewiki.net.
Change-Id: I9a6247d859298451199ef0e457ff9b209268c496
2022-02-17 08:11:41 +01:00
Translation updater bot 77034e77c2 Localisation updates from https://translatewiki.net.
Change-Id: I2f0cac5dd1cefeb2af78920aa0096882bbcfb64f
2022-02-16 08:12:56 +01:00
Translation updater bot 881faf0788 Localisation updates from https://translatewiki.net.
Change-Id: Ic91fe369d927fc079a64dec957ecd6fd7073c9a5
2022-02-15 08:17:11 +01:00
jenkins-bot 902a389474 Merge "Prevent floated content from leaking out of the preview container" 2022-02-14 21:07:53 +00:00
jenkins-bot 2645cf0757 Merge "Log talk_page_edit events for adding a new topic" 2022-02-14 21:06:41 +00:00
Bartosz Dziewoński f9f7aeb295 Prevent floated content from leaking out of the preview container
Change-Id: Ic4c5267cbe44fa22537a708f66e08503d0c1f816
2022-02-14 20:47:39 +01:00
David Lynch d1e62d364d Log talk_page_edit events for adding a new topic
Bug: T301496
Change-Id: I618339f254c89db45891ee403f037c555afdda6e
2022-02-14 11:48:16 -06:00
Translation updater bot b86c291422 Localisation updates from https://translatewiki.net.
Change-Id: I5939ff3e24d2d36268991ff3dda82e373b5415b0
2022-02-14 08:14:10 +01:00
Bartosz Dziewoński e414d1acaf Improve handling for comments after fake headings using wikitext ;
Bug: T265964
Change-Id: I77db68928c5426fd885a277eec52c6e164d559bb
2022-02-11 23:35:32 +00:00
Bartosz Dziewoński 62766e846c Add test case for fake headings using wikitext ;
Bug: T265964
Change-Id: I31db66dc011b3d13dd46426f15286c5b3b5c9254
2022-02-12 00:35:02 +01:00
jenkins-bot c49d518ff1 Merge "Update references to warningbox class" 2022-02-11 21:20:49 +00:00
Translation updater bot 0ded0d5bfb Localisation updates from https://translatewiki.net.
Change-Id: I10d162707ecc233f37d3c7c6d5bc175b1a7eb00a
2022-02-11 08:41:25 +01:00
Translation updater bot 92e3a5bb42 Localisation updates from https://translatewiki.net.
Change-Id: I1acdee01d5cfe2b22f99c73df8068f86a1f3529d
2022-02-10 08:41:31 +01:00
jenkins-bot 8bcaf75372 Merge "Replace use of deprecated OutputPage::enableClientCache( false )" 2022-02-10 07:01:26 +00:00
Bartosz Dziewoński 4ff65cf5e2 Update references to warningbox class
Bug: T301401
Depends-On: I632e42ee9065b38dca443beae1cb01ef714cae7b
Depends-On: I7a7046bf9b9765cbb82ec3caa1530de7f05e0da4
Change-Id: Ia42cf9cd5b63cfe679bdf90bfcbf528f14f9ebcc
2022-02-09 21:36:50 +01:00
jenkins-bot 548c0d12c9 Merge "build: Update eslint-config-wikimedia to 0.22.1" 2022-02-09 15:38:41 +00:00
jenkins-bot aa64257169 Merge "Don't refer to non-existent fields when using 'hide-if'" 2022-02-09 15:37:30 +00:00
Bartosz Dziewoński 8b6ffc945f Don't refer to non-existent fields when using 'hide-if'
Bug: T301317
Change-Id: I40577b41e0c957281a45b71802808ec535b65653
2022-02-09 15:38:47 +01:00
Ed Sanders f0940557ee build: Update eslint-config-wikimedia to 0.22.1
Change-Id: I18a5ceae9e8fdc6398cd27c24c1a97fe87e3c016
2022-02-09 13:50:55 +00:00
Translation updater bot a88dafba19 Localisation updates from https://translatewiki.net.
Change-Id: I4e4ceaed5a09c6713c4669aba7a054dfc5113db9
2022-02-09 08:12:45 +01:00
jenkins-bot 9b2b887675 Merge "ThreadItem: Use DOMUtils to get HTML of DocumentFragment" 2022-02-09 00:53:43 +00:00
Ed Sanders 16c24d6f0a ThreadItem: Use DOMUtils to get HTML of DocumentFragment
This fixes a warning this was thrown when the fragment
was empty (e.g. a placeholder heading).

Change-Id: I5d44993014280b210f48be6be8db0c58ab8e0352
2022-02-08 23:51:38 +00:00
jenkins-bot 362206e572 Merge "Improve check for HTML comments after multiple line breaks" 2022-02-08 20:17:26 +00:00
jenkins-bot e8e9ba5f98 Merge "Fix some typos in comments" 2022-02-08 20:00:11 +00:00
jenkins-bot 4593a9fe91 Merge "Don't count leading/trailing whitespace against signature scan limit" 2022-02-08 20:00:08 +00:00
jenkins-bot e82a4d86f3 Merge "Don't clear target comment highlight when Ctrl-clicking" 2022-02-08 19:49:44 +00:00
Ed Sanders aa03dc971e Add discussiontoolscompare API
For two given revisions, this API tells us which comments have
been added and which have been removed.

Can be used to highlight new comments, or check if the page
has been updated since we first loaded it.

Bug: T281624
Bug: T300504
Change-Id: Ia4d95ffe3b7cf2317cd8e7c0f034e09f64777ef3
2022-02-08 15:53:27 +00:00
Translation updater bot f8c7887adf Localisation updates from https://translatewiki.net.
Change-Id: I4baeb2087e91695285486af51734ac759eb88d59
2022-02-08 08:28:29 +01:00
Bartosz Dziewoński fa01395acc Improve check for HTML comments after multiple line breaks
In the example in T301214, there is a space character between the line
breaks.

Bug: T301214
Change-Id: Ia1a8279ba0c60f92c1a30463c2a39d9e954ae3ca
2022-02-08 01:38:56 +01:00
Ed Sanders 025130fcd2 Don't prompt to reload the page if the reply widget is open
Only show the reload prompt if the 'disappeared' error is detected
when the reply widget is loading. Don't show it if we failed
to save, as it suggests you will not lose content if you reload.

Change-Id: I106f274e180dc97b540d729e31aae575c43f29f0
2022-02-07 22:45:35 +00:00
Ed Sanders 3d0849112a ReplyWidget: Factor out #createErrorMessage
Change-Id: Ie7e34154d74c24ce8379552fdf13feba31fd401f
2022-02-07 22:44:09 +00:00
jenkins-bot 4ac8e94084 Merge "ReplyWidget: Introduce a 'refresh' teardown mode that preserves auto-save" 2022-02-07 21:45:13 +00:00
Bartosz Dziewoński 909f1383d4 Don't clear target comment highlight when Ctrl-clicking
It annoys me when Ctrl-click clears it but middle-click does not.

Change-Id: I8636140df25d44ac79cb2bc0d1aebecc62c4db5d
2022-02-07 21:29:01 +00:00
jenkins-bot 6a23be0bb5 Merge "Move ApiDiscussionTools to ApiDiscussionToolsPageInfo" 2022-02-07 20:43:26 +00:00
jenkins-bot 283aa46865 Merge "extension.json: Sort ApiModules" 2022-02-07 20:43:24 +00:00
Ed Sanders 7cad692afa Move ApiDiscussionTools to ApiDiscussionToolsPageInfo
Also remove 'paction' param, and instead make 'transcludedFrom' a
property of the result object.

Change-Id: I0a289f6d71e4708afff0b52066b1ed6faf76b9ae
2022-02-07 16:50:02 +00:00
Ed Sanders ee2749d34a extension.json: Sort ApiModules
Change-Id: I0fea49bd7f86dd6ca48fb1960e47c62abeaf41aa
2022-02-07 16:49:40 +00:00
Translation updater bot 413b7bd487 Localisation updates from https://translatewiki.net.
Change-Id: I0ad51f8f4a6c5501a5def55689fbcd5622031dac
2022-02-07 08:21:57 +01:00
libraryupgrader faab80cd8d build: Updating nanoid to 3.2.0
* https://github.com/advisories/GHSA-qrpm-p2h7-hrv2

Change-Id: I397685f0d9b0f77fcfd6f9f9524136d718870320
2022-02-06 09:18:30 +00:00