Commit graph

499 commits

Author SHA1 Message Date
Bartosz Dziewoński 0fc71f60cd Skip to the end of the paragraph if it's just text, too
We've recently decided that we want to "extend" comments until
the end of the paragraph (e36dc8e78a,
d0ae6c4e44).

However, we still had this special case that did the opposite: it
ensured that if a comment ended in the middle of a text node, the
comment would not be extended to the end of the node. Remove it.

Note the change in the test file signatures-funny-formattedreply.html,
which actually covered this case specifically.

Change-Id: Id1384bb0c6e1a5f0c70f55efcb4caa240f230f07
2020-11-25 00:48:53 +01:00
jenkins-bot aa0e89e3cf Merge "Skip end marker "forward" until a block tag is reached" 2020-11-23 17:00:34 +00:00
jenkins-bot c87f6ef031 Merge "De-indent multi line comments when fetching comment bodies" 2020-11-23 16:20:54 +00:00
Ed Sanders d0ae6c4e44 Skip end marker "forward" until a block tag is reached
The end marker is skipped forward until an open or close
block tag is reached. In tree traversal terms this means
moving either to the next sibling, or the parent (to skip
over close tags).

Bug: T256033
Change-Id: Iaa2c588698790d576ac4f9ecc126f58a082ef6b3
2020-11-23 15:08:29 +00:00
jenkins-bot 7467e89da4 Merge "Fix displaying reply links after posting a reply with dtenable=1" 2020-11-22 23:02:21 +00:00
jenkins-bot 4eed14b4e7 Merge "Fix client-side IDs for indistinguishable comments" 2020-11-22 22:38:57 +00:00
Ed Sanders 15696f141c De-indent multi line comments when fetching comment bodies
Change-Id: Iaacd227ce2185f4fe2b29463a33b038de7aadb7e
2020-11-22 21:49:08 +00:00
jenkins-bot cac72e1c99 Merge "Fix start node for comments following headings" 2020-11-20 18:22:34 +00:00
Ed Sanders 44a1bbcc59 Fix start node for comments following headings
The general rule is that comments start after their preceding
thread item, but when that is a heading we should skip past
the entire <h[1-6]> node to avoid making section edit links
part of the first comment.

Bug: T267988
Change-Id: Ia7f1b27e0a69a9aab7c7da743bf8549479304096
2020-11-19 23:48:30 +00:00
Bartosz Dziewoński d0b6904bae Fix client-side IDs for indistinguishable comments
Bug: T268093
Change-Id: I198b090904e3ae5f2e214b457233d61cb77802af
2020-11-18 20:08:21 +01:00
Bartosz Dziewoński c17a076382 Fix displaying reply links after posting a reply with dtenable=1
Bug: T267847
Change-Id: Ifb59cb942b673d9abcab563e6bc27fa1f6d5e9d7
2020-11-18 19:29:04 +01:00
Ed Sanders e2f93727d4 Improve highlighter styling
Change-Id: Ie2982d1f8da217cad2fe7080137c39900451c591
2020-11-16 23:34:26 +00:00
Ed Sanders 2328a3cad0 Group comment warnings in DOM so they don't break alternate colours
Change-Id: I0516a57a30a59ee6eac0ad2f23f05ad83c396391
2020-11-16 23:32:56 +00:00
Ed Sanders 4d0498853d Highlighter: Fix check for comment warnings
This was causing the highlighter to not alternate colours.

Change-Id: I9bb95e02ae91967c696f026198efb27d4d8414d4
2020-11-16 23:18:05 +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
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
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
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
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
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
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
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
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
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
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
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
jenkins-bot 8cd5dc386b Merge "Clear page data cache after posting a reply" 2020-10-22 21:37:13 +00: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
Bartosz Dziewoński 044bc50fb6 Fix some TODOs about test data
We avoided fixing these because it causes changes in just about all of
the test data, which is annoying when reviewing or blaming changes.

But the previous several commits also caused changes in just about all
of the test data, so we might as well do this too.

Change-Id: I83b64d83b6f12c04dc06c0cadff7cdd89417e137
2020-10-22 00:21:04 +00:00
Bartosz Dziewoński 0ddc171c8a Add oldest timestamp in the thread to heading IDs
To avoid old threads re-appearing on popular pages when someone
uses a vague title (e.g. dozens of threads titled "question" on
[[Wikipedia:Help desk]]: https://w.wiki/fbN), include the oldest
timestamp in the thread (i.e. date the thread was started) in the
heading ID.

Bug: T264478
Change-Id: If918bfd5e025248923d1939bc86916697ead95a0
2020-10-22 02:19:21 +02:00
Bartosz Dziewoński b09bbfe668 Disambiguate comments by parent ID, rather than sequential numbers
Sequential numbers aren't great because they change when an earlier
comment is archived. Parent comment/heading IDs should change less
often.

This also makes much more sense for disambiguating subsections,
e.g. a dozen identical ===Votes=== sections for a dozen proposals.

Bug: T264478
Change-Id: I466454984fd919ebef35f2b37ddb5d86dc842996
2020-10-22 02:19:21 +02:00
Bartosz Dziewoński 3137d76f40 Connect sub-threads to their parent threads
Our threads now also contain all replies to their sub-threads.
This is similar to how sections work in MediaWiki, where the parent
section also contains the content of all the lower-level sections.
We're going to need this for notifications about replies in a thread.

Bug: T264478
Change-Id: I241fc58e2088a7555942824b0f184ed21e3a8b6f
2020-10-22 02:05:02 +02:00
Bartosz Dziewoński 9ee0fd69f5 Allow headings to have IDs
Previously, only comments could have IDs, because we only needed IDs
for replying. But we might also use them for notifications soon.

Bug: T264478
Change-Id: I1bcad02bf17ab54bc5028a959543c10f0430836b
2020-10-22 02:04:28 +02:00
Bartosz Dziewoński 6719d17364 Handle cached "legacy" IDs (and other JSON-serialized data)
The output of CommentFormatter::addReplyLinks() and consequently
ThreadItem::jsonSerialize() can end up in the HTTP cache (Varnish) on
Wikimedia wikis. We need to consider that when changing that code.

Introduce a concept of legacy ID (generated by the older algorithm
after it changes), add some placeholder code that will generate them
in the future, and update some code to find comments by either normal
or legacy IDs.

Add dire comments in a bunch of places (as if that ever helps).

Bug: T264478
Change-Id: I4368f366800ab21b8b184b09378037614fdecd33
2020-10-22 00:53:06 +02:00