Commit graph

1375 commits

Author SHA1 Message Date
Ed Sanders 32cd64ec6a Use Parsoid DOMCompat/DOMUtils in CommentFormatter
As CommentFormatter no longer needs HTMLFormatter, remove
the inheritance and make addReplyLinks a static method.

Testing locally this is marginally slower, going from 2.55s
to 2.9s for the CommentFormatterTest case.

Bug: T266317
Bug: T267973
Change-Id: If69749cae678a1647a138d782a32032189f55cec
2020-11-16 22:28:07 +00:00
Ed Sanders 7d349808c2 ImmutableRange: Guard against appending empty fragments
This triggers a PHP warning.

Change-Id: I5ccb204287d55b38fadcef8cc846400a277e8491
2020-11-16 19:22:26 +00:00
Ed Sanders b03165fcce Compare node positions using upward traversal
A TreeWalker ends up walking potentially every single subsequent
node in the document looking for a target node. Instead use upwards
traversal to find a common ancestor, then sibling traversal to
compare document order.

This makes calling cloneContents on every comment on a 300k talk page
significantly faster, going from >30s to 500ms locally.

Change-Id: I28a2b8c11d4098d9bc44d19b98e19ccc02273098
2020-11-16 19:22:10 +00:00
jenkins-bot 5a5b2e61f1 Merge "ImmutableRange: Avoid doing expensive TreeWalker computation twice" 2020-11-15 14:43:01 +00:00
jenkins-bot 5937226f5f Merge "ImmutableRange: Skip redundant calls to isFullyContainedNode()" 2020-11-15 14:42:50 +00:00
Thiemo Kreuz 8ffe0d55da Remove comments that literally repeat what the code says
Change-Id: Ib928cf61dc512fbbf39a3279789376d635a82c52
2020-11-11 09:31:59 +01:00
jenkins-bot 76e6acf925 Merge "ReplyWidget: Ensure scrollbar doesn't appear in source mode" 2020-11-10 15:46:51 +00:00
Bartosz Dziewoński d5a1b7bc2b ReplyWidget: Ensure scrollbar doesn't appear in source mode
Even though the field is supposed to resize itself to match the text
inside, vertical scrollbar would sometimes appear when the user has
zoomed in. Some calculation probably handles fractions of pixels
incorrectly (might be a bug in OOUI or a browser bug).

Since this field has no limit on max rows, we can just hide the
scrollbar. This can't be fixed in OOUI itself, since its autosize text
fields usually have a limit to how tall they are allowed to grow
before a scrollbar is used.

Bug: T267609
Change-Id: Id36ed417c4678e469a6c05715404e330064c2017
2020-11-10 12:20:30 +01:00
Translation updater bot db94c4e266 Localisation updates from https://translatewiki.net.
Change-Id: Ia3a9f07350c75289ab38fae48c5409d79a6b902a
2020-11-10 08:40:11 +01:00
Translation updater bot f036aedd6a Localisation updates from https://translatewiki.net.
Change-Id: I26327fe245eb89156bf4486927aff0583628e578
2020-11-09 08:34:38 +01:00
Translation updater bot e4535ee968 Localisation updates from https://translatewiki.net.
Change-Id: If8e43474e308b6da2ca11eb33278d42a52a03d82
2020-11-06 08:33:39 +01:00
jenkins-bot 579cc20120 Merge "Move ID->title logic into HeadingItem" 2020-11-05 18:10:08 +00:00
jenkins-bot e378a9122b Merge "Don't detect comments within headings" 2020-11-05 16:56:02 +00:00
jenkins-bot 1f284947bb Merge "Always use ':' for indentation in preview" 2020-11-05 16:41:23 +00:00
Ed Sanders 3c88f7de39 Always use ':' for indentation in preview
Matches what we end up posting. Leave context-aware code
commented out as this issue is not settled yet.

Change-Id: I7360e53d5d7823b2b52318005459212a21a6edc2
2020-11-05 16:15:38 +00:00
Ed Sanders 79c91c3cfc Move ID->title logic into HeadingItem
Change-Id: I03408d2404a99b5bc7795c1c4bf214d4b5fea1e0
2020-11-05 16:10:39 +00:00
Ed Sanders 47b31101b8 ApiDiscussionToolsEdit: Remove stray line from old code
Change-Id: Id9561482d6fc2c2241790e61df1db71a4d520554
2020-11-05 16:02:58 +00:00
Bartosz Dziewoński 203a4dcb42 Use 'id' attributes rather than heading text for edit autosummaries
Ideally the edit autosummary would be generated in the same
way as in the old wikitext editor: from the wikitext of the
heading. But on the JS side, we don't have access to the
wikitext, or to the PHP method that generates autosummaries.

This might seem crazy at first, but ultimately the point of
the autosummaries is to link to the section heading by its
'id' attribute, so it is perfectly reliable.

Doing it this way depends on $wgFragmentMode being set to
[ 'html5', 'legacy' ] or [ 'html5' ], otherwise the escaped IDs
are super garbled (particularly in non-Latin-alphabet languages)
and can't be unescaped reliably. Conveniently, we already
require that since 9ee0fd69f5.

Bug: T264561
Bug: T266725
Change-Id: I7d35098d672d0edb50d49e22de1686d5cc83b60e
2020-11-05 15:13:08 +00:00
Bartosz Dziewoński bed717d329 Move getHeadlineNodeAndOffset() to utils
Needed by I7d35098d672d0edb50d49e22de1686d5cc83b60e.

Change-Id: I44bf927213de570fe9de43e485e09cfae6778eef
2020-11-05 16:11:30 +01:00
Bartosz Dziewoński 986e83ee61 Fix getHeadlineNodeAndOffset() returning text nodes
The condition was wrong, it could return either an element child with
.mw-headline, or a non-element child.

Bug: T267284
Change-Id: I28cda22ee8c5fe4a3259621adddd647b31291703
2020-11-05 16:09:35 +01:00
Translation updater bot db915bd141 Localisation updates from https://translatewiki.net.
Change-Id: I39a386f4bab8eb069447d4d25c928951ef6ad3cc
2020-11-05 08:28:38 +01:00
Ed Sanders 7abd4621ae Use new heading markers for getting heading ranges/text
This will need to be deployed a few days after I782caafc3
to avoid issues with cached HTML.

Change-Id: I4b00d0b0efed9d91c0bc28914bbdf0955bb552b6
2020-11-04 21:04:40 +00:00
Bartosz Dziewoński 1626242863 Don't detect comments within headings
Bug: T267068
Change-Id: Id134f15e086fd070801c4b1d836dbfbf9bf444ad
2020-11-04 21:57:33 +01:00
Translation updater bot 24c224a3e7 Localisation updates from https://translatewiki.net.
Change-Id: Ifdeb9c4f4f3546e6aada4f1ebbe943db09b3922c
2020-11-04 08:33:17 +01:00
libraryupgrader 7d19ec42e2 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
Change-Id: I513674e64115593d9a8effedac77fca31a56adce
2020-11-03 17:39:19 +00:00
Translation updater bot 23b915a91e Localisation updates from https://translatewiki.net.
Change-Id: Ib58bfa020a08abea22e868183c831e99e0bbcef5
2020-11-03 08:44:07 +01:00
jenkins-bot ad715a2724 Merge "Move warnings stuff from CommentItem to ThreadItem" 2020-11-02 22:03:36 +00:00
Bartosz Dziewoński 885d05b57b Handle any errors, not just exceptions
Internal PHP errors (such as "Call to undefined method…") are not Exceptions.
Follow-up to e18a0f3dcd.

Bug: T267035
Change-Id: I3cbf2b6b0d1d8a97cdac9791ec4f7b2ec807c7e5
2020-11-02 21:51:16 +01:00
Bartosz Dziewoński 31f6d44bf6 Move warnings stuff from CommentItem to ThreadItem
After recent changes allowing ThreadItems to have IDs, they can now
also have warnings about duplicate IDs.

Bug: T267035
Change-Id: If3edfe34e6e29741e29fac8946a3c88badc4ab7f
2020-11-02 20:07:23 +00:00
Bartosz Dziewoński e18a0f3dcd Handle exceptions in the OutputPageBeforeHTML hook
Instead of breaking the whole page, just log it and add a HTML comment.

Bug: T267035
Change-Id: Icec26cddb9db4816640d06881ed683e76067d54f
2020-11-02 20:15:37 +01:00
Translation updater bot 68ac32a1da Localisation updates from https://translatewiki.net.
Change-Id: I3c2355181fb7ad8988a5ef1261b11264084e488f
2020-11-02 08:52:51 +01:00
jenkins-bot f3c5d405b3 Merge "Switching editor modes would switch editor_interface before success/fail" 2020-10-30 23:19:06 +00:00
jenkins-bot 1baf837a19 Merge "ReplyWidget: Hide external links icons in the footer" 2020-10-30 17:43:22 +00:00
jenkins-bot 8f54ca44ac Merge "ReplyWidget: Fix exception when toggling the "Advanced" drawer" 2020-10-30 17:19:35 +00:00
Translation updater bot fd257f983d Localisation updates from https://translatewiki.net.
Change-Id: I4ee580a153b66b641cd88787caf88413e8dc1c2f
2020-10-30 08:28:14 +01:00
Ed Sanders 12823e33c6 Fix label of new topic tag
Bug: T260467
Change-Id: Ib5ef64c4998af6df2448f51c7c2fb509df8041a0
2020-10-29 19:46:01 +00:00
jenkins-bot 65d58c3869 Merge "Fix fetching of headline node with new HTML" 2020-10-29 16:35:52 +00:00
Bartosz Dziewoński bc2e4ed170 Make the "Advanced" menu preference hidden
Follow-up to 2f28cfdf56.

Bug: T261539
Change-Id: I8837885064b669e56dfaef9d1315926e7875d0b0
2020-10-29 15:43:34 +00:00
Ed Sanders 6450cea848 Fix fetching of headline node with new HTML
This code path needs to work with new and old HTML
markup around headings.

Change-Id: I2291e407e68423b34fca4d53362680d97ab44a71
2020-10-29 15:41:26 +00:00
libraryupgrader fb6706a606 build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic

Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).

Change-Id: I340d6b573e9ae2a99085fb19a705fcf567b03f92
2020-10-29 10:53:01 +00:00
Translation updater bot bee806c2ff Localisation updates from https://translatewiki.net.
Change-Id: I2234d83965725f9b627114676581df276a81e4b9
2020-10-29 08:27:35 +01:00
David Lynch b3186f8d6a Switching editor modes would switch editor_interface before success/fail
Also, stop the dialog-prevent-show event from switching editor_interface
just because it's tied to the `editor-switch` feature.

Bug: T259673
Change-Id: I2acf9d79add281ed0f62f022e44bb18948ceafc8
2020-10-28 21:59:32 -05:00
Bartosz Dziewoński 282c987efa ReplyWidget: Hide external links icons in the footer
Bug: T266686
Change-Id: I20debf936d73e4615b485e1b089616de8646e624
2020-10-28 18:07:43 +01:00
Bartosz Dziewoński 157d34c852 ReplyWidget: Fix exception when toggling the "Advanced" drawer
Bug: T266685
Change-Id: I9ba7761abbdeb1ee6f3449287923f7a77d85c531
2020-10-28 18:07:34 +01:00
Ed Sanders 3aca622894 Treat headings like comments now they have IDs
Use the same logic for marking ranges in the document, and ensure
that the heading range does not include section edit links or
section numberings.

Change-Id: I782caafc34fee2a822b0a17b24dd6b9528202eca
2020-10-28 12:38:18 +00:00
Translation updater bot f397beea06 Localisation updates from https://translatewiki.net.
Change-Id: I09089fd4f79e47ad8edcb3d75e89ee8a116da766
2020-10-28 08:35:54 +01:00
jenkins-bot 333486fd85 Merge "Add preference to expand the "Advanced" menu when replying" 2020-10-27 11:42:41 +00:00
jenkins-bot 6792c0c9c9 Merge "Include 'false' results in 'transcludedfrom' API response" 2020-10-27 11:38:52 +00:00
Translation updater bot a74ce86663 Localisation updates from https://translatewiki.net.
Change-Id: I9698abad5d5f2ef652c8493f40a28e9756f067e1
2020-10-26 08:30:36 +01:00
Ed Sanders 8aba15ec9c Pass uselang with API requests
Bug: T266195
Change-Id: Ib605a54cba62052044e96c6a3276bfd500d3a7cc
2020-10-23 12:32:00 +01:00