Commit graph

614 commits

Author SHA1 Message Date
Ed Sanders 633cc9a7b3 Debug: Introduce "vote" debug mode
Bug: T269163
Change-Id: Ie8da7acf3660a6d30b92d7803d87ad51a3275369
2020-12-12 13:21:48 +00:00
Ed Sanders 43443971a0 ThreadItem.js: Fix documentation comment
Change-Id: I2b0207eb5f3689845daf5e6dd293a59d2ec890b2
2020-12-12 12:58:16 +00:00
Ed Sanders 15cb419f56 Debug: Fix signature range higlighting
Change-Id: Ieb5af739bb98761d8473edb87f1eb752dc386ea1
2020-12-12 12:56:54 +00:00
Ed Sanders a082535e02 Fix styling of error/captcha MessageWidgets
Change-Id: I592c1a08238dc46ee342672be29a8070b495f3dd
2020-12-11 16:27:07 +00:00
Ed Sanders fb0cc01ff8 Skip over empty inline templates (e.g. tracking templates)
Bug: T269036
Change-Id: I15e56041c1f1ecb85e9e368a9fbb07882438bf8d
2020-12-09 18:51:41 +00:00
Bartosz Dziewoński 8c9230fa10 Handle category links like comments (rendering-transparent nodes)
Bug: T269036
Change-Id: Id4321ad09907b5030881456c93da90a39bdfdd75
2020-12-08 21:39:16 +00:00
Bartosz Dziewoński 113ad01d5e Consistent use of isBlockElement() in JS code
(Consistent compared to our PHP code)

Change-Id: I4aba6f22cc7da2da30ccd6346e4390b14bd347af
2020-12-05 22:48:34 +01:00
jenkins-bot 54f13b11a0 Merge "Tweak colors and timing of the highlight on posted comments" 2020-12-05 01:49:53 +00:00
Ed Sanders b71376a183 Trim signatures when added on a new line
Bug: T269188
Change-Id: I48d394020b8780ff93d97747d45009c37c071b53
2020-12-02 20:18:42 +00:00
Bartosz Dziewoński b92ae47e00 Tweak colors and timing of the highlight on posted comments
* Use a slightly different color
* Use 'mix-blend-mode: multiply' when available to avoid fading
  the text color
* Add fade-in animation and make fade-out animation slower

Bug: T268994
Change-Id: I210ed4fd55c3dc184d13daf915fa93bee3699ad5
2020-12-01 23:44:39 +01:00
Bartosz Dziewoński 7c01e20e47 Add postEdit notification
Per T267595#6656121

Bug: T268994
Change-Id: I2c47fc36ff6515b1f5f5e6bfd11f41eec9c1cd86
2020-12-01 21:43:39 +00:00
jenkins-bot d52f6334ea Merge "Show keyboard shortcuts in button tooltips" 2020-11-26 18:12:03 +00:00
jenkins-bot 019307660e Merge "Don't include the logged in user in local suggestions" 2020-11-26 18:08:46 +00:00
Ed Sanders 1871c70378 Show keyboard shortcuts in button tooltips
Bug: T264913
Change-Id: I3c5b248f7c7b0ef381baab84fe98d4ba0cefd35a
2020-11-26 19:06:17 +01:00
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
Ed Sanders a87d60228f Don't include the logged in user in local suggestions
Bug: T267680
Change-Id: I1b2d185de390b73e1b389fc4139735069e7a65dc
2020-11-16 22:48:21 +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
Bartosz Dziewoński 3b8d63467e CommentParser: Remove confused comments about references and objects
"This modifies the original objects…" – I feel like this is obvious
now, but maybe it wasn't so obvious when this code was structured
differently before a2431fe006. Also,
it refers to a variable that doesn't exist.

"FIXME this will clone the reply…" – No, actually, it will not.
It would if replies were associative arrays, but they are objects,
and have always been, ever since the PHP parser was merged in
7b7a2cd69c. Maybe they were arrays
once in Roan's mind before he pushed that for review.

Change-Id: I1348e111699fdbde99cd1f9ef45d8f465f7391b0
2020-10-21 21:01:27 +02:00
Bartosz Dziewoński 2f28cfdf56 Add preference to expand the "Advanced" menu when replying
* Add the preference
* Only display it when the reply tool is enabled
* Use it when opening the reply tool
* Save it when the menu is toggled from the reply tool interface

Bug: T261539
Change-Id: Icb8fa6b3f1e9a3644669f21b08f34ea8c175f2f9
2020-10-20 07:09:40 +02:00
Ed Sanders d0bcec6196 Enable DT server side via a cookie to preserve user enable hack
Bug: T265499
Change-Id: Ied330c633732651d1c4e136646afd676ceb570c7
2020-10-19 21:42:58 +01:00
jenkins-bot 8716fbf9e2 Merge "Add reply links on the server" 2020-10-13 20:46:53 +00:00
Ed Sanders 64392af485 Add reply links on the server
Bug: T252555
Change-Id: I4e60fdbc098c1a74757d6e60fec6bcf8e5db37c1
2020-10-08 13:27:08 +01:00
Ed Sanders dfdadee481 Simplify edit summary selection logic
Always select the default reply if it looks unchanged, i.e.
we see '...*/ Reply' at the end of the summary.

Bug: T263062
Change-Id: I0a79d9e5072d9d9df16c93435502f67524e2d2bc
2020-10-07 18:56:17 +01:00
jenkins-bot f9276d6b84 Merge "Ignore other empty-ish things at the beginning of comments" 2020-10-06 00:34:31 +00:00
jenkins-bot 6d5b41ad2c Merge "Remove number when reading heading node" 2020-10-05 23:22:35 +00:00
Ed Sanders eeefd985d6 Remove number when reading heading node
Bug: T264561
Change-Id: I0e6235f6b7169665e403fd6db1812fe90e8932b0
2020-10-05 21:58:51 +01:00
Bartosz Dziewoński be2ec55114 Work around Chromium bug with triple-click selection and reply links
Through trial and error, I found that adding `display: inline-flex;`
avoids the issue, and does not seem to have any negative effects in
Chromium or other browsers.

Bug: T260072
Change-Id: I9a9ca1fdb57bb7dd6c1a0a70e330a2a503c8ec8e
2020-10-02 19:17:34 +02:00
Bartosz Dziewoński ed17f640b6 Ignore other empty-ish things at the beginning of comments
Follow-up to 432a959436.

Bug: T264116
Change-Id: I0685cafab70c7e9d22f504f1a1309c9a28d6f2e1
2020-09-30 23:42:47 +02:00
jenkins-bot 91e87eb09a Merge "Fix detecting username from the wrong links sometimes" 2020-09-30 18:18:02 +00:00
jenkins-bot f7c7ba3c44 Merge "Ignore empty paragraphs at the beginning of comments" 2020-09-30 18:16:36 +00:00
Bartosz Dziewoński 17b7a481a2 Fix detecting username from the wrong links sometimes
When a timestamp directly followed a `<div>…</div>` tag (or perhaps
some other wrapper containing lots of content), we would detect the
username from the earliest links in the wrapper (furthest from the
timestamp), rather than the latest links (closest to the timestamp).

Bug: T262573
Change-Id: Id16449a86a731b13dc79846bb30ecf6554e26f1d
2020-09-29 22:31:24 +02:00
Bartosz Dziewoński 432a959436 Ignore empty paragraphs at the beginning of comments
The wikitext parser outputs `<p><br></p>` for empty paragraphs, so we
need to ignore `<br>` tags when searching for an "interesting" node
that marks the beginning of a comment. Otherwise the empty paragraphs
mess up the detection of indentation levels.

Bug: T264116
Change-Id: I84a97ab577baa7336b78935ccdc48041ecfc231a
2020-09-29 22:22:35 +02:00
Ed Sanders 6b8312e610 Ignore HTML comments which are more than two lines from a reply
Bug: T264026
Change-Id: I989132d7599a7fa156dba46d87a9ed4b76322c0c
2020-09-29 11:30:03 +01:00
jenkins-bot 75a3a62f0a Merge "ReplyWidget: Pass initial config values to #setup, not to constructor" 2020-09-25 21:51:20 +00:00
jenkins-bot c6e69d586f Merge "Fix vertical alignment of action buttons when logged out" 2020-09-25 18:18:43 +00:00
Bartosz Dziewoński 48d5a67d41 ReplyWidget: Pass initial config values to #setup, not to constructor
The same ReplyWidget instance can be re-used when the user cancels
replying and then starts replying again to the same comment.

Previously, the initial values passed to the constructor (when switching
modes) would still persist in this case, even if they were incorrect.

Bug: T263061
Change-Id: I3dff007456bfd4f3149c718ae72fbf373a2e2913
2020-09-25 20:00:00 +02:00
Ed Sanders 06d42957a5 Fix vertical alignment of action buttons when logged out
Bug: T263871
Change-Id: Id2c39b630ddbbd6232f67a161de3f74f36a7cd6b
2020-09-25 17:54:00 +00:00
jenkins-bot 197f103081 Merge "Disable find-and-replace" 2020-09-25 16:58:17 +00:00
Ed Sanders 6790e5c41c Disable find-and-replace
Bug: T263570
Change-Id: I075c1696f179eed2e0143c12082cee048c200227
2020-09-25 15:17:15 +01:00
Bartosz Dziewoński ca41a405ec Fix debug mode after language variant changes
Follow-up to 329df8c953.

Change-Id: I49f7d580a7e7c5dde7c234ca8905157e6a0f4f5d
2020-09-24 19:49:04 +02:00
jenkins-bot b1804fbb8b Merge "Add content getters to Thread/Comment items" 2020-09-21 22:35:24 +00:00
jenkins-bot e7206488a8 Merge "Collapse advanced drawer when clearing" 2020-09-21 21:08:03 +00:00
jenkins-bot db82dce31f Merge "Only reset summaryPrefixLength on user event" 2020-09-21 21:06:29 +00:00
jenkins-bot e4fa3d3593 Merge "Always send edit summary, regardless of visibility" 2020-09-21 21:06:28 +00:00
Ed Sanders e6b91ced43 Collapse advanced drawer when clearing
Bug: T263061
Change-Id: Ibcd95ce1c86548962b9b7ff7b62bd0d127f53b76
2020-09-21 20:52:47 +01:00
Ed Sanders 9d3eea5fdf Only reset summaryPrefixLength on user event
Bug: T263062
Change-Id: I323ce4dab0a430e2aeb906ae9cd5d6b48a179cff
2020-09-21 20:39:21 +01:00
David Lynch b988eca191 When preventing switching modes, don't log a type-specific action
Just log dialog-prevent-show.

Bug: T259673
Change-Id: I336ad745a3bd92b9a5d40fc0962be2084a6cc589
2020-09-17 16:52:32 -05:00
jenkins-bot 636ca06e7e Merge "Fix parsing links in Parsoid documents without short URLs" 2020-09-17 20:40:40 +00:00
Ed Sanders 5c2abccf2a Always send edit summary, regardless of visibility
Bug: T262501
Change-Id: If5a8837afc8d91f4d46db1d928142d775da010c1
2020-09-17 20:06:51 +01:00
jenkins-bot 328674d042 Merge "Parsing discussions converted to language variants" 2020-09-16 22:52:37 +00:00
Bartosz Dziewoński 329df8c953 Parsing discussions converted to language variants
* Export parser data (date format, digits, timezone names, and
  messages for weekday/month names) converted to language variants
* Update the parsers to try matching using every variant, in case
  the page is displayed in non-default variant (and to avoid
  problems with incomplete variant conversion)

Bug: T259818
Change-Id: I04d73992cd31ce06fa79f87df0c0a53d7efc3c58
2020-09-16 22:07:07 +00:00
jenkins-bot 53cb5a3b19 Merge "'transcludedfrom' API response is an object, not array" 2020-09-16 22:02:16 +00:00
jenkins-bot 75f073759f Merge "Bypass useless API requests on non-existent pages" 2020-09-16 20:40:01 +00:00
Bartosz Dziewoński 39f4bf8626 'transcludedfrom' API response is an object, not array
Change-Id: Ibad2190cdf79b677cdf021f3253d1f432860f6e6
2020-09-16 22:30:11 +02:00
Ed Sanders fe8c40759b Bypass useless API requests on non-existent pages
The reply tool will do nothing on a new page, but we will
soon have the new discussion tool here.

Change-Id: Id772f7cc1f8701d659f3c7209c07dc4eb857e1fc
2020-09-16 12:19:42 +01:00
jenkins-bot 55a4e376fe Merge "Documentation fix" 2020-09-14 23:46:08 +00:00
Ed Sanders 92a8ca3469 Documentation fix
Change-Id: Ic37bb713bed8af7390a3e8be7ea0203b4687ce0e
2020-09-15 01:38:54 +02:00
DLynch aab80e8641 Merge "Log when the advanced mode panel is toggled" 2020-09-14 22:39:32 +00:00
jenkins-bot c02f54a848 Merge "Edit summary in advanced mode" 2020-09-14 22:29:59 +00:00
David Lynch 5b20503ec2 Log when the advanced mode panel is toggled
Bug: T261816
Change-Id: Iadd17b4f5280fc09d7a16a64bb709bab1a1a09d5
2020-09-14 22:14:40 +00:00
Ed Sanders ebaa132ebf Edit summary in advanced mode
Bug: T249391
Change-Id: Ibfd1cf77293d30b8e0d9869bbdc9aae2aa830a06
2020-09-14 22:29:54 +01:00
Ed Sanders 5ced26b718 Add content getters to Thread/Comment items
Change-Id: I29cd36eb63bfa00e333efb3c6d7d7e1cdc58cf65
2020-09-12 13:19:36 +01:00
jenkins-bot fa2ee6cfe6 Merge "Skip over whitespace when looking for trailing comments" 2020-09-11 18:46:17 +00:00
Bartosz Dziewoński 34fb7c6497 utils: Avoid Node#contains for IE 11 support
Bug: T260061
Change-Id: Ifd1e9067ab16a65349a460e935bb95f5895432db
2020-09-11 18:06:44 +00:00
Ed Sanders d4f67918b2 Skip over whitespace when looking for trailing comments
Bug: T257651
Change-Id: Icce377f1833b80bd066622d6be3e711a18c58eea
2020-09-11 15:37:09 +01:00
Ed Sanders ebe2071dfd Upstream setPending to ReplyWidget
Now consistently uses setReadOnly instead of setDisabled.

Slight styling regression was fixed in I01e11c2ed.

Change-Id: Ice7ce00929ff9a53d0fb533f1094e7324749f3a4
2020-09-09 19:23:34 +00:00
Bartosz Dziewoński 14fb013515 Match handling of "signature scan limit" between JS and PHP
PHP was counting UTF-8 bytes, JS was counting UTF-16 bytes.
Both should have been counting codepoints (although it doesn't
really matter as long as they both count the same things).

I noticed the issue after adding some tests using the Cyrillic
script, when one case had different results in PHP and JS:
Id25b537fecd789640c209ff7f30e777455a3aece.

Change-Id: Ic31240678f71ba48e6ec202126bf490cea12bb66
2020-09-08 03:27:01 +02:00
Bartosz Dziewoński 10899af666 Fix parsing links in Parsoid documents without short URLs
Move the code so that we check for "?title=" query parameter first,
because we don't handle this right in the other code path.

Use parse_url() instead of wfParseUrl() because the latter doesn't
accept relative URLs, and we don't care about the other differences.

Bug: T261711
Depends-On: I4da952876e1c3d1a41d06b51f7e26015ff5e34d7
Change-Id: I70fac2b41befd782b0a47a4f726ae748dc0f775d
2020-09-02 23:42:37 +02:00
Bartosz Dziewoński ff05e0c0b5 Improve error message for edit conflict
Bug: T261788
Change-Id: I079517ad6e258dd23b9048f4133f18cbb087acd9
2020-09-01 22:33:25 +02:00
jenkins-bot 8bf420e869 Merge "Fix parsing localised digits in PHP discussion parser" 2020-09-01 17:16:29 +00:00
jenkins-bot 7e069cdb00 Merge "Update watchlist status from API result" 2020-09-01 00:29:03 +00:00
Bartosz Dziewoński 2d3fe47ac1 Fix parsing localised digits in PHP discussion parser
The PHP code incorrectly assumed that the digits are single-byte in
UTF-8, which is never the case (except for 0-9).

The JS code worked correctly because it uses UTF-16 strings, so the
bug would only affect non-BMP digits there. This was noted in a TODO
comment, but we overlooked it when reimplementing in PHP.

Instead of a string of 10 characters, use an array of 10
single-character strings.

Bug: T261706
Change-Id: Ic5421382474c88f003424799c53ff473d99cce92
2020-09-01 01:50:33 +02:00
Ed Sanders d664e0dae4 Update watchlist status from API result
Mirrors the change made in VE in I2c844223.

Bug: T260434
Change-Id: I013e6e7b3a267de09a4e8100b98c77c22cb5b1fd
2020-08-29 20:31:58 +00:00
Bartosz Dziewoński 5e1b6b1b81 Skip past our own reply buttons when displaying reply widget
Without this, the reply widget would be inserted before the reply button,
in the middle of the paragraph.

Follow-up to e36dc8e78a.

Change-Id: I5e22a0a0b70e8da395eb23dd6ae80af70840a2e2
2020-08-29 16:24:48 +02:00
Ed Sanders c240f281a4 Pass through watchlist state to response data
This got lost when the watchlist updating code was refactored
out into controller.js, as it assumes that 'data' (the post data)
is still available.

Bug: T261362
Change-Id: Id274e7b8518b62dddbc3d4095d9f6cab17aa17cd
2020-08-26 23:50:06 +01:00
Ed Sanders d36ffeaa3d build: Update eslint-config-wikimedia to 0.17.0
Remove variable shadowing, and fix some documentation.

Change-Id: I08a7cbbdc0a1a409f9c4415b36c62c89535e12eb
2020-08-26 23:46:34 +01:00
jenkins-bot ca279832cc Merge "Fix reply widget documentation" 2020-08-25 19:10:11 +00:00
jenkins-bot f83e2370c1 Merge "Skip to the end of the paragraph in the parser, not modifier" 2020-08-25 11:56:10 +00:00
jenkins-bot 4218d930a7 Merge "Fix error handling in controller#getPageData" 2020-08-25 11:11:39 +00:00
jenkins-bot 4be90d7494 Merge "Re-apply new reply API patches (again)" 2020-08-25 11:11:12 +00:00
jenkins-bot e1eb983d51 Merge "parser: Code quality tweaks" 2020-08-20 20:01:03 +00:00
Bartosz Dziewoński e36dc8e78a Skip to the end of the paragraph in the parser, not modifier
When a comment ended before the end of a paragraph, the next
comment would begin right there in the middle of the paragraph.
This could result in the detected indentation level of that
comment being incorrect, and replies being inserted in wrong
places, as seen in the 'signatures-funny' test case.

The code moved to the parser was previously repeated twice in
addListItem() and addReplyLink(), which should have been a hint
that something isn't quite right.

Also, fix the code guarding against overlapping signatures,
now that signatures may not be at the end of a comment.

Bug: T260855
Change-Id: Ic26a87642f8a15d5de2f7073d4d8176b299c7f94
2020-08-20 19:35:55 +00:00
Bartosz Dziewoński 84cb9d1dca parser: Code quality tweaks
Do things in a more intuitive order, avoid some repetition,
rename a vaguely named variable.

Change-Id: Ic1a0bb54134682eaf126231e04eb67847d6a5da6
2020-08-20 20:52:42 +02:00
jenkins-bot 5f8214a2e4 Merge "parser: Fix comment ranges when timestamp has entities" 2020-08-20 12:10:43 +00:00
Bartosz Dziewoński 03539527b4 Fix error handling in controller#getPageData
We were accidentally resolving the promise with `undefined`, rather
than rejecting it. This later caused "TypeError: Cannot read property
'linterrors' of undefined" in controller#checkCommentOnPage.

Bug: T260294
Change-Id: I29418988023d86140cfa110c0c348059b293a716
2020-08-19 20:06:09 +00:00
Ed Sanders c32a8996c7 Fix reply widget documentation
Change-Id: I46d033595ecf6c226ae23aefb03884841a3299c7
2020-08-19 20:05:55 +00:00
Bartosz Dziewoński b706eac8bc Re-apply new reply API patches (again)
This reverts commit 4d7c98b97c.

Change-Id: I4100521efb687ec324d25e273a9c986fd5dac0d0
2020-08-19 20:05:42 +00:00
jenkins-bot 1159172e32 Merge "Fix crash when trying to mention invalid usernames" 2020-08-18 15:35:29 +00:00
jenkins-bot 470c630662 Merge "Revert new reply API (again)" 2020-08-17 20:22:58 +00:00
Bartosz Dziewoński e0312957e6 Fix crash when trying to mention invalid usernames
Change-Id: I1e7213c38067e3c3107752705c4d3e4ed64a9258
2020-08-16 22:50:32 +02:00
jenkins-bot b31c9ae7fb Merge "Allow the mention prefix to be configured via a message" 2020-08-16 19:17:13 +00:00
Bartosz Dziewoński 4d7c98b97c Revert new reply API (again)
Causes page corruption, in a new way we haven't seen before.

* Revert "Move page updating logic to controller.js"
  This reverts commit 54fdc6de06.
* Revert "ReplyWidget: Move clear methods from #teardown to #clear"
  This reverts commit 9b811a94e0.
* Revert "ApiDiscussionToolsEdit: Do not pass 'basetimestamp'"
  This reverts commit 7de5938a6f.
* Revert "Use DOMCompat::getOuterHTML instead of doc->saveHTML()"
  This reverts commit 7b2448d2f0.
* Revert "CommentController: Remove remains of client-side edit conflict handling"
  This reverts commit 2d038af705.
* Revert "Restore error message for when comment is deleted while replying"
  This reverts commit 655c0526d6.
* Revert "Use transcluded from API to avoid ever fetching Parsoid DOM in client"
  This reverts commit 9d0fc184fe.
* Revert "Create a 'transcludedfrom' API endpoint"
  This reverts commit 5d8f3b9051.
* Revert "Edit API for replies"
  This reverts commit 8829a1a412.

Bug: T259855
Change-Id: I6419408c6194ec0afa6b8ee604b12c1a24c6ac7b
2020-08-13 20:19:29 +02:00
Ed Sanders 54fdc6de06 Move page updating logic to controller.js
Change-Id: I9cd11f49a9dd7bf9c6aa034359244c3a21f459e8
2020-08-13 11:59:41 +01:00
Ed Sanders 9b811a94e0 ReplyWidget: Move clear methods from #teardown to #clear
Change-Id: Ieb02f57d31579ac9c3ee2f20f07f9107e70348d4
2020-08-13 11:11:08 +01:00
Ed Sanders cc8b43b678 Allow the mention prefix to be configured via a message
Bug: T250332
Change-Id: I83c59fc665bbfe1027149bcb1cbce3f69d90c7ff
2020-08-12 18:45:25 +01:00
Bartosz Dziewoński 375bfe028e parser: Fix comment ranges when timestamp has entities
Previously, parser would output offsets that don't exist in their
containers, because we were pretending that entities are parts of
their neighboring text nodes.

Turns out it's much easier to do it right when going backwards.

Change-Id: I9bccca2d403f1a976ae517449989170cdd99721e
2020-08-11 20:41:06 +02:00
jenkins-bot b681eec8e4 Merge "Allow reply widget header and footer to wrap when it's narrow" 2020-08-10 22:27:51 +00:00
jenkins-bot 4d4722a6ab Merge "Fix indentation level when replying to comments with mixed indentation" 2020-08-10 22:27:44 +00:00
jenkins-bot 7a18cc8902 Merge "Always use ':' (<dl><dd>) for indentation of replies" 2020-08-10 22:27:42 +00:00
Bartosz Dziewoński 2d038af705 CommentController: Remove remains of client-side edit conflict handling
In commit 8829a1a412 we kept this code
when adding the reply API, but on second thought it doesn't actually
make sense.

The reply API should never fail with an edit conflict normally, since
it makes the edit on the latest version of the page. If it does fail,
I think it's better to just show the error message. Current behavior
is to retry, and if that doesn't actually solve the problem, this ends
up in an infinite loop.

Bug: T252558
Change-Id: I5e0dcb2c42e5de4f18e99b8a761ca048a430b31e
2020-08-10 20:27:57 +02:00
jenkins-bot 9e7287d233 Merge "Do not include .dt-init-replylink-buttons in printouts" 2020-08-10 17:43:02 +00:00
Ed Sanders d43d66a5a4 Username suggestion header
Bug: T252084
Depends-On: Ie57dbe76725cc7d4c9a1c959623349ad707d0b88
Change-Id: I5e8b7582199d6b5674bdf8e9328c881a8c7c7673
2020-08-10 17:34:04 +00:00