Commit graph

404 commits

Author SHA1 Message Date
Bartosz Dziewoński ff77db5ef4 Temporarily disable failing test
Bug: T328072
Change-Id: I6613cb8c2673be82ccd030639015bb626b2fe21b
2023-01-26 20:25:23 +01:00
Bartosz Dziewoński af68c835bb Update exception handling for new code conventions
Change code to match the documented consensus formed on T321683:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Exception_handling

* Do not directly throw Exception, Error or MWException
* Document checked exceptions with @throws
* Do not document unchecked exceptions

For this extension, I think it makes sense to consider DOMException an
unchecked exception too (in addition to the usual LogicException and
RuntimeException).

Depends-On: Id07e301c3f20afa135e5469ee234a27354485652
Depends-On: I869af06896b9757af18488b916211c5a41a8c563
Depends-On: I42d9b7465d1406a22ef1b3f6d8de426c60c90e2c
Change-Id: Ic9d9efd031a87fa5a93143f714f0adb20f0dd956
2023-01-22 18:17:11 +00:00
Bartosz Dziewoński cfd76f5eb0 Add test for DiscussionTools TOC additions
We verify that they appear in the action=parse API output.

We should also have a test to verify that they appear in the Vector
2022 skin, but that might have to be done as a browser test.

Bug: T326677
Change-Id: I81d5ddecd3b244aeee8cba71498f4d65f8e53696
2023-01-19 21:59:50 +00:00
jenkins-bot 8facd83609 Merge "Improve handling for comment separators" 2023-01-17 11:48:43 +00:00
jenkins-bot 63c236edba Merge "Add another test case for {{tracked}} template" 2023-01-17 11:48:39 +00:00
jenkins-bot 8b8dba6124 Merge "Test ServiceWiring.php" 2023-01-17 05:53:07 +00:00
Umherirrender ecac4c3bd1 LanguageData: Use special page alias with spaces
The alias stored in the language files is with underscores,
but the value is compared in CommentParser against text with spaces

Affected languages: bjn, hu, id, jv, kaa, tl, tpi, vi, war

Bug: T327021
Change-Id: I8626627d10a240973e631e24508937a9eee9fb14
2023-01-16 22:27:23 +01:00
Dreamy Jazz 68ae9555f1 Test ServiceWiring.php
Test ServiceWiring.php using tests copied from CentralAuth. Because
phpunit does not support marking a file as covered, the ServiceWiring
file is ignored for code coverage as the tests fully cover the file.

Change-Id: I7da8d74fec84a5aa9c77bc0678ad8f55b550893a
2023-01-13 12:01:38 +00:00
Bartosz Dziewoński 3a9997d6ea Improve handling for comment separators
* Detect comment separators at the end of comments too
* Consider TemplateStyles associated with ignored templates

This unexpectedly improves a lot of cases other than T313097 too,
mostly where <br> or {{outdent}} was used within a paragraph:
splitting comments that were previously jumbled together, or restoring
content that was previously ignored for apps / notifications.

Bug: T313097
Change-Id: I9b2ef6b760f2ffd97141ad7000f70919aeab7803
2023-01-10 01:59:52 +00:00
Bartosz Dziewoński 56dcaa833b Add another test case for {{tracked}} template
Bug: T313097
Change-Id: I3ac1bfe40d808eee32f9b713dc40f502a6e54f8a
2023-01-10 01:59:46 +00:00
jenkins-bot 984f804f17 Merge "Don't collapse the lede section when it has comments" 2022-12-05 19:04:37 +00:00
Bartosz Dziewoński b4475801fd Don't collapse the lede section when it has comments
Bug: T324139
Change-Id: I14e1dae0fef4177f5a6a223bc9b663e99c9f741c
2022-11-30 20:25:22 +01:00
James D. Forrester 7017acaf1d Follow-up be012ced: tests: Provide some basic direct tests for CommentUtils::getTitleFromUrl
Change-Id: Idb44d7890b05e0d9d90fdabe46f295b80996f60c
2022-11-29 15:43:18 -05:00
jenkins-bot 36af2d1002 Merge "Allow replying to some comments with accidental complex transclusions" 2022-11-24 14:00:45 +00:00
jenkins-bot 6e00c904cf Merge "Add test cases for T313093" 2022-11-24 14:00:42 +00:00
jenkins-bot eb9631164d Merge "Place replies outside transclusions, disallow replying to transcluded comments" 2022-11-24 14:00:40 +00:00
jenkins-bot b155d12e8e Merge "Add test case for T313100" 2022-11-24 14:00:37 +00:00
Derick Alangi 672ca86016 ApiDiscussionToolsTrait: PageInfo & Compare don't need HTML for editing
ApiDiscussionToolsPageInfo and ApiDiscussionToolsCompare in direct parsoid
or VRS modes tries to fetch HTML using VisualEditor thus stashing the
HTML gotten which we don't want, we only need it for viewing in these cases.

This seems like something that was/is already happening in RESTBase. So for
APIs in DiscussionTools that need the HTML for viewing, just get it from
parser cache and not stash it.

Bug: T323357
Change-Id: I101c1e84739a2ac1f562f2f7bdc4b8f53d9f3b23
2022-11-21 16:29:13 +01:00
Bartosz Dziewoński 0432eaf1e3 CommentFormatter: Fix condition for lede button to consider new wrappers
Bug: T323171
Change-Id: I3125f98e57bf410f19ece07b8376c92ae619d0ea
2022-11-15 23:39:45 +01:00
Bartosz Dziewoński 3a0b05f564 Allow replying to some comments with accidental complex transclusions
When a comment almost exactly matches the range of an
accidental complex transclusion consisting only of
pages from the 'Template' namespace and wikitext fragments,
I think we can safely allow replying to the comment.

Even if this turns out to be incorrect in some cases,
the failure will be more graceful after the changes in T313100:
instead of potentially duplicating contents from a template,
the worst case now is that the reply will appear in the wrong
place (at the end of the transclusion).

Bug: T313093
Change-Id: Ie8da09d74a652d893fd8c3e2435ef6cb70fad64a
2022-11-14 19:17:36 +01:00
Bartosz Dziewoński 82069f7db5 Add test cases for T313093
Change-Id: I045be8da8fc144846312ce84b9e79d65c3d5b2b4
2022-11-14 19:17:34 +01:00
Bartosz Dziewoński 469b7720af Place replies outside transclusions, disallow replying to transcluded comments
Bug: T313100
Change-Id: I3993c96ec8d3d0add33d779860d158327985107d
2022-11-14 19:17:18 +01:00
Bartosz Dziewoński 065c7d8f2d Add test case for T313100
(Also README corrections)

Change-Id: I037155ba1b775511273a78a85b34c29f3319a9a6
2022-11-14 19:16:43 +01:00
Bartosz Dziewoński 04cfffe323 Move visualenhancements metadata and some buttons outside of <h2>
We wrap a `<div>` tag around the `<h2>`, and move some elements there.
The markup is inspired by and compatible with my proposal for T13555.

The "ext-discussiontools-init-section" class is moved to the `<div>`.

A small patch is needed in MobileFrontend to preserve the section
collapsing functionality: I11bff21e81046898ca63f3f432797129fa70ad88.

The following elements are now outside of `<h2>`:
* Metadata bar
* Subscribe button
* Ellipsis menu (only shown on mobile)

The following elements are sadly still inside of `<h2>`:
* Subscribe links (only shown on desktop)
* Section edit links from MediaWiki core
Trying to move them mucks up the CSS too much. I hope we can resolve
this later as a part of the work on T13555.

Depends-On: I11bff21e81046898ca63f3f432797129fa70ad88
Bug: T314714
Change-Id: I0bbdcfa02c334858737855349d7a35746de1d8f2
2022-11-10 23:35:40 +01:00
Ed Sanders 79521f89cf Add button to reveal lede section on mobile
Bug: T312309
Depends-On: I9c3035c9dbe7545a05efb2286dffe0145d3557b4
Change-Id: I9d74914ddbcc9def74e85106a68574a807b0b731
2022-11-10 22:10:04 +00:00
Bartosz Dziewoński d8325ac9b8 CommentFormatterTest: Fix PHP 8.1 deprecation warning
Change-Id: I1913eff29e884be4eb6177b9aa8e29fe297560c7
2022-11-10 23:03:06 +01:00
Bartosz Dziewoński 9cde62957f CommentFormatterTest: Make desktop and mobile separate test cases
This is a better way than a loop in the test code.

When using DISCUSSIONTOOLS_OVERWRITE_TESTS, if both desktop and mobile
cases fail, both will be updated now. Previously the first failed
assertion would stop the test after only updating one file.

Change-Id: I4ce6f45b047e02c9f00024a9e5057adcb0e28047
2022-11-09 02:44:30 +01:00
jenkins-bot c83bad9de8 Merge "Embed pageThread JSON in jsConfigVars instead of infusing HTML" 2022-11-08 18:59:48 +00:00
Bartosz Dziewoński dac09416fd LanguageDataTest: Set 'UsePigLatinVariant' => false
MediaWiki default changed in Ia80ad33cbf5e311fa8b84bd765a8df8d156f4c38.

Change-Id: Ib1eb4b218c89d2a6ce8b82aeec2ee19aca8ff4a9
2022-11-08 18:13:36 +00:00
Ed Sanders a00131a18f Embed pageThread JSON in jsConfigVars instead of infusing HTML
Bug: T322651
Depends-On: I86d461756398780dc24949013f35b7730a481052
Change-Id: I85ee8e6ed6eba97b94f4e4c415fbc5286c234cce
2022-11-08 16:20:39 +00:00
jenkins-bot 98285f3b27 Merge "ThreadItemStore: Update existing rows if possible rather than insert+delete" 2022-11-03 14:12:49 +00:00
Bartosz Dziewoński c4c455c550 ThreadItemStore: Update existing rows if possible rather than insert+delete
Bug: T321121
Change-Id: I678b093aef95febb33cf4b0140b0625ef3241779
2022-11-03 00:53:19 +01:00
Bartosz Dziewoński 433e57394c Use PHP 7.4 property types
Change-Id: I788db64f0c0c00894d77256b7f016d44eda4bbb1
2022-10-28 21:56:38 +02:00
jenkins-bot da907eb610 Merge "Don't apply topic containers to table-of-contents heading" 2022-10-26 16:30:28 +00:00
jenkins-bot c9dadbfe7d Merge "Remove support for <span class="mw-headline-number"> in headings" 2022-10-26 16:29:41 +00:00
jenkins-bot d55b8f8d2f Merge "Don't insert comment markers inside <figure>" 2022-10-26 16:28:37 +00:00
Bartosz Dziewoński 9cbb0a8c60 Don't apply topic containers to table-of-contents heading
Change-Id: I3abbf7907907f6280e6b58bcf4307c0ce3b1898e
2022-10-25 18:59:25 +00:00
Bartosz Dziewoński c6cd20f682 Remove support for <span class="mw-headline-number"> in headings
This feature has been removed from MediaWiki in change
Ic9ed88f419419cf4cc5cc32010539eea8b76314b.

Change-Id: If11b33589f47eab614f5129b38e80d0f3cafa083
2022-10-25 18:59:05 +00:00
jenkins-bot 6ab2abc958 Merge "ThreadItemStoreTest: Add test for old revisions of indistinguishable comments" 2022-10-25 00:05:00 +00:00
jenkins-bot 2e28320eb2 Merge "ThreadItemStore: Fix updates for identical revision timestamps" 2022-10-24 23:57:07 +00:00
jenkins-bot 095277b40c Merge "ThreadItemStoreTest: Add test for identical revision timestamps" 2022-10-24 23:57:05 +00:00
jenkins-bot 11d10e9e64 Merge "ThreadItemStoreTest: Use a consistent ordering for the output" 2022-10-24 16:23:30 +00:00
Bartosz Dziewoński d2df103803 Don't insert reply tool outside <section> on mobile
Bug: T319148
Change-Id: I7db0ef1980f4997b77593f3d43d35886ecd8a4ae
2022-10-21 01:20:13 +02:00
Bartosz Dziewoński 0116bed3ad Add test case for <section> wrappers on mobile
Bug: T319148
Change-Id: Ic8e29a8a5626b2dee1c258fec18a9b016ecae06b
2022-10-21 01:20:13 +02:00
Bartosz Dziewoński 66cac8523e ThreadItemStoreTest: Add test for old revisions of indistinguishable comments
Just to confirm that this works correctly, because I broke it a few
times in different ways while working on T321121.

In this scenario, discussiontools_item_revisions contains rows for
the oldest and newest revisions of pages containing each comment
distinguishable by name, as well as extra rows for the newest
revisions of comments indistinguishable by name, so that they can
be looked up by ID.

Change-Id: Ic8450a6b082ed343dd633d3a43c50696b5d6d2bb
2022-10-20 03:50:47 +02:00
Bartosz Dziewoński 33f4006713 ThreadItemStore: Fix updates for identical revision timestamps
Use revision IDs to break the tie, consistently with MediaWiki (see
RevisionStore::getRelativeRevision) instead of assuming that the
revision we're processing now is somehow both older *and* newer than
the other one (the mind boggles how that ever made sense to me).

Change-Id: I9f1a07124301a36be68578d908353b72f0442c00
2022-10-20 02:37:47 +02:00
Bartosz Dziewoński c922e1babd ThreadItemStoreTest: Add test for identical revision timestamps
discussiontools_item_pages row itp_id=5 has incorrect
itp_oldest_revision_id. It should point to the older of the two
revisions with the same time, but it points to the newer one.
discussiontools_item_revisions row is missing.

Depends-On: I56f0e161e5438d5f77b7d53d4db7411f90f97d05
Change-Id: I61ed42515891a84729455a7a32c98276c7cacd40
2022-10-20 02:36:40 +02:00
Bartosz Dziewoński ed23ff1ad7 ThreadItemStoreTest: Use a consistent ordering for the output
In preparation for changes affecting how the data is stored (T321121).

Change-Id: I1d6edeb016431dd33e50cfbea1533a92b056a2a7
2022-10-20 01:49:19 +02:00
jenkins-bot 3c53a489cf Merge "CommentFormatter: Always add the overflow menu" 2022-10-18 16:16:42 +00:00
Bartosz Dziewoński 1d6ba985be Fix parsing of non-English titles in JS tests
Same issue as b68832ace0 in PHP.

Change-Id: Ide6ebc47929b597e6dc23df696d87bb3130ce276
2022-10-17 17:10:53 +02:00