Commit graph

1309 commits

Author SHA1 Message Date
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
Ed Sanders 3b31aa669d Create controller.getApi method with defaults
Only share API objects when it is safe to do so.

Change-Id: I4810f59ce41c43f78e0b42db6b36620b2aca1cec
2020-10-23 12:30:37 +01:00
Translation updater bot 9add814c4f Localisation updates from https://translatewiki.net.
Change-Id: I0f458b151dc63d770804f2893ae4d1a476b01718
2020-10-23 08:37:55 +02:00
jenkins-bot bf66eb9498 Merge "Add legacy IDs as of wmf/1.36.0-wmf.14" 2020-10-22 21:46:33 +00:00
jenkins-bot 70cd85690f Merge "Fix some TODOs about test data" 2020-10-22 21:46:20 +00:00
jenkins-bot 1456e3d798 Merge "Add oldest timestamp in the thread to heading IDs" 2020-10-22 21:46:18 +00:00
jenkins-bot aeffdd5edd Merge "Disambiguate comments by parent ID, rather than sequential numbers" 2020-10-22 21:46:15 +00:00
jenkins-bot c9766dbbac Merge "Connect sub-threads to their parent threads" 2020-10-22 21:44:39 +00:00
Bartosz Dziewoński 6f2ada2bb4 ImmutableRange: Avoid doing expensive TreeWalker computation twice
If A follows B, then we can assume that B does not follow A.
Calling the function recursively computes that twice,
we can instead make some simple changes to "invert" the result.

Change-Id: I709aca7cb997dd2fe3980468a8c6bde6f366fb5b
2020-10-22 23:39:14 +02:00
jenkins-bot 8cd5dc386b Merge "Clear page data cache after posting a reply" 2020-10-22 21:37:13 +00:00
Bartosz Dziewoński a29cecdf73 ImmutableRange: Skip redundant calls to isFullyContainedNode()
It's an expensive method, and we previously called it for
every child of the common ancestor, completely unnecessarily.

These changes follow from two observations:
* If there is a $firstPartiallyContainedChild, then the
  first fully contained child must follow it; similarly,
  if there is a $lastPartiallyContainedChild, then the
  last fully contained child must precede it.
* All nodes between the first and last fully contained
  children are also fully contained.

Maybe it can be made cleverer still, but it's a lot better.

Change-Id: I4e596c62274c2c0be115f0ddec42629115b430a4
2020-10-22 23:31:21 +02:00
Bartosz Dziewoński ba8434e2e0 Add legacy IDs as of wmf/1.36.0-wmf.14
Bug: T264478
Change-Id: I099e1068fedc25d671cd1245ac8b32941dca7232
2020-10-22 22:52:59 +02:00
Bartosz Dziewoński 7ad6328223 Include 'false' results in 'transcludedfrom' API response
Skipping them could result in incorrect handling when RESTBase HTML is
outdated.

When a result for a given comment is not found, display an error
instead of assuming it is not transcluded.

Bug: T262065
Change-Id: I14a7a0a25d5181b5c49bd5677f0c002dce5a3cb9
2020-10-22 22:25:35 +02:00
Bartosz Dziewoński c72efee5ce Clear page data cache after posting a reply
We depended on the oldid (wgCurRevisionId) changing after a reply is
posted, but it will not change if we posted to a transcluded page.

Bug: T266275
Change-Id: I1baa1f2227134b73fd663de2fee3ea96a2f9b183
2020-10-22 21:52:05 +02:00
Ed Sanders 9b965c45b5 Set 'useskin' when using API action=parse
Bug: T266195
Change-Id: I65c3e71924e0e126cac95088a4c3774cee8e8a72
2020-10-22 21:31:49 +02:00
jenkins-bot 516361937d Merge "Allow headings to have IDs" 2020-10-22 11:51:15 +00:00
jenkins-bot 57cb9ca6f8 Merge "Handle cached "legacy" IDs (and other JSON-serialized data)" 2020-10-22 11:51:13 +00:00