Commit graph

2130 commits

Author SHA1 Message Date
David Lynch 71049f4ce8 Add item name to the JSON output of HeadingItem
The name is needed for the topic subscription API

Bug: T285971
Change-Id: Iedbebdfd65d03ab01b22b35781803655749aa269
2022-03-25 11:45:50 +00:00
Translation updater bot 7239aab22f Localisation updates from https://translatewiki.net.
Change-Id: I78e7d4323c78ef791aeabbfb2025569bb2ff3cf4
2022-03-22 08:29:21 +01:00
jenkins-bot d91fe7aad0 Merge "CommentUtils: Fix isSingleCommentSignedBy() with empty heading" 2022-03-21 23:45:53 +00:00
Bartosz Dziewoński c5375e05b9 CommentUtils: Fix isSingleCommentSignedBy() with empty heading
Change the order of checks to ensure that we have at least one comment
before we try comparing ranges, to avoid issues with empty headings
having collapsed ranges. It should be a tiny bit faster this way, too.

Bug: T304377
Change-Id: I59ad30cfc075dcec882e048d2d199744efec2114
2022-03-22 00:12:42 +01:00
David Lynch 7275377b3c Talk API for apps
Exposed as DiscussionToolsPageInfo prop threaditemshtml. It returns a
version of the output of CommentParser, lightly adjusted to provide a
nested comment structure rather than a pure flat list.

Bug: T285971
Change-Id: I2f8503d4ed740a04fb2f1e3a37ae4db649b3faba
2022-03-21 16:40:45 -05:00
Translation updater bot 0a68477f91 Localisation updates from https://translatewiki.net.
Change-Id: Ida65502d4ec12f56bf6f27cd014f2cb0ae2bbe7c
2022-03-21 08:14:37 +01:00
Translation updater bot aa1accebf1 Localisation updates from https://translatewiki.net.
Change-Id: I90621f8d91f70c9c7a9c5825d5e6cb5d734765a0
2022-03-17 08:36:57 +01:00
Translation updater bot 962d15df93 Localisation updates from https://translatewiki.net.
Change-Id: I7e9a38b9e65ccbbff08940b31bae2ad003dd9d39
2022-03-16 08:07:32 +01:00
jenkins-bot 0f8bd17634 Merge "Refactor highlights into a class, and add window resize listener" 2022-03-15 22:48:37 +00:00
jenkins-bot 6948f0b3f3 Merge "Move cache expiry update from ParserAfterParse to ParserAfterTidy" 2022-03-15 21:44:44 +00:00
C. Scott Ananian 8e09b67c0d Move cache expiry update from ParserAfterParse to ParserAfterTidy
The ParserAfterParse hook will likely be deprecated, as Parsoid can't
properly support it as-is.  Luckily, DiscussionTools isn't doing
anything in ParserAfterParse that couldn't happen in the (supported)
ParserAfterTidy hook.

Bug: T303630
Change-Id: If72feb1e277c09f4ea0df339f2dd097a9b329d71
2022-03-15 12:19:57 -04:00
Ed Sanders 3c66f066c2 Refactor highlights into a class, and add window resize listener
Bug: T303616
Change-Id: Id369cdfc511a7f0f5e19fff4c6424bec2f34ff55
2022-03-14 14:57:19 +00:00
Translation updater bot 8a42e67558 Localisation updates from https://translatewiki.net.
Change-Id: Ibd00de72425017d96fab51879eaed57713841fd8
2022-03-14 08:13:52 +01:00
Translation updater bot 7b471fd0f1 Localisation updates from https://translatewiki.net.
Change-Id: Iaba0b7cc4e3e0c13edd5296070781bd4feb07650
2022-03-11 08:32:28 +01:00
Bartosz Dziewoński 01b253c5b6 Don't allow the root node to be treated like a comment frame
Also fix a bug where headings would be ignored while checking for
comment frames. See task for detailed explanation.

Bug: T303396
Change-Id: I6495826b4b050ea80680e0798ac6ab4497a7c09e
2022-03-10 17:45:08 +00:00
Bartosz Dziewoński 77614a2d02 tests: Fix root node / container handling
Since times immemorial, and for reasons lost to history, our test code
was adding an extra <div> wrapper before parsing the HTML used for
tests. This wasn't a problem, until now, because I want to add some
tests for T303396 that need to check that the *real* wrappers present
in some test cases are handled correctly.

Changes to test cases mostly remove a leading "0/" from serialized
ranges, corresponding to removing the extra wrapper.

Change-Id: Ia50e3590538c8cd274b02d2a937ba1a3fbb4ac89
2022-03-10 18:43:58 +01:00
jenkins-bot dd24b0edcd Merge "Improve handling for comments after fake headings using wikitext ;" 2022-03-10 16:21:18 +00:00
Translation updater bot b486b40835 Localisation updates from https://translatewiki.net.
Change-Id: I09ad330a75bf2d8641109a644594f0b9b166c018
2022-03-10 08:19:04 +01:00
jenkins-bot d4a99f3e10 Merge "CommentModifier: Micro optimization to avoid copying" 2022-03-10 00:22:17 +00:00
jenkins-bot 32d9ef573a Merge "CommentParser: Avoid using a dynamic undeclared property" 2022-03-10 00:22:16 +00:00
jenkins-bot 76478dda26 Merge "Move signatureScanLimit to a constant in JS" 2022-03-10 00:22:14 +00:00
jenkins-bot bd43c2a139 Merge "Add test case for fake headings using wikitext ;" 2022-03-10 00:17:49 +00:00
jenkins-bot dfcb2f4fc7 Merge "Fix highlighting of comments when reloading" 2022-03-09 22:44:48 +00:00
jenkins-bot 456041cf6c Merge "ImmutableRange: Add @property annotations for magic props" 2022-03-09 14:58:59 +00:00
jenkins-bot e991910343 Merge "CommentParser: Fix redundant uses of getHeadlineNodeAndOffset()" 2022-03-09 14:57:45 +00:00
Ed Sanders 457f6eb7d1 Fix highlighting of comments when reloading
The CommentController stores a list of the new comments that
triggered the reload warning. Just highlight all the comments
in this list, as we always reload to the revision we got from
the same API call.

Bug: T303261
Change-Id: I960f3cf33e25004bad6ab6df907121a87555aaf4
2022-03-09 14:47:03 +00:00
Translation updater bot 77071a5bdd Localisation updates from https://translatewiki.net.
Change-Id: I6a28bb912f771944f9c6261fe6e8858c6af76174
2022-03-09 08:09:25 +01:00
Bartosz Dziewoński 8529a33f29 CommentModifier: Micro optimization to avoid copying
It has no noticeable effect on the runtime of tests.

Change-Id: Ia4a20ba9667f3b772f960331c61f5aad857bf6cd
2022-03-08 23:30:15 +00:00
Bartosz Dziewoński 4c29304484 CommentParser: Avoid using a dynamic undeclared property
Change-Id: Iefa8dea83bc0d31b9c6b3509189eeaa652dd9ea0
2022-03-08 23:30:11 +00:00
Bartosz Dziewoński 08c79142fb ImmutableRange: Add @property annotations for magic props
Phan can analyze them now and reports some issues with types.

* Add some assertions on types where we're sure that we're using an
  Element or non-null, but Phan can't prove it
* Fix incorrect type hints on getFullyCoveredSiblings() and
  getCoveredSiblings(), luckily it was harmless

Change-Id: I8cc12450378efa7434c4d66882378b715edd4a70
2022-03-08 23:29:40 +00:00
Bartosz Dziewoński eb1fe7a8fb CommentParser: Fix redundant uses of getHeadlineNodeAndOffset()
We call CommentUtils::getHeadlineNodeAndOffset() before constructing
the HeadingItem in CommentParser, so the range's startContainer
is always the headline node.

Change-Id: I2afb6ba9100e785cd91f31d82f4cea59fa8b5443
2022-03-08 23:29:34 +00:00
Bartosz Dziewoński 0e576216b2 CommentUtils: Fix confusing types in getIndentLevel()
Change-Id: I548cf4ad54e92c22da64caf53ee028a906cd3b62
2022-03-08 23:29:15 +00:00
Bartosz Dziewoński 584f6a020c Use tagName rather than nodeName when we know the node is an element
`tagName` is only defined on Element, and it returns its tag name.

`nodeName` is defined on Node, and it returns the tag name for Elements,
and a string like '#text' or '#document-fragment' for other types.

We were using both, which made it harder to reason about what types
we're dealing with.

Change-Id: I8e621e5872bdf78c84ec553cfbfcdbf0192f0589
2022-03-08 23:29:05 +00:00
Bartosz Dziewoński 063174e71c Use instanceof for checking for text/element nodes in PHP
It is friendlier for static analysis tools like Phan, which can't
infer anything from the `->nodeType === …` checks, and we were already
using it in most places.

Fix newly revealed Phan failures (and one unneeded suppression).

Change-Id: Id789f05e16a210f7ba22ca7514587c392fac0741
2022-03-08 23:28:39 +00:00
jenkins-bot 1f7ff387a7 Merge "New topic: skip tabbing into the mode tabs until you've focused the body" 2022-03-08 23:18:37 +00:00
jenkins-bot 4b2f9ede8e Merge "Use MessageWidget's showClose option" 2022-03-08 22:41:39 +00:00
Bartosz Dziewoński 4134a80fdc Fix handling of disabled 'mobileformat'
Boolean parameters must be omitted completely if they're false.

Bug: T303262
Change-Id: Icc1bb4f557ce4de137f3e40b186074190f194dea
2022-03-08 14:00:22 +01:00
Translation updater bot f1d1f1c5f7 Localisation updates from https://translatewiki.net.
Change-Id: Iea92d1e30030cda4d6124a814dc9fa663babb796
2022-03-08 09:01:34 +01:00
jenkins-bot 738e5461f8 Merge "Fix logic for finding the oldest comment in a bundle" 2022-03-08 02:23:57 +00:00
Ed Sanders 039d8e21e4 Fix logic for finding the oldest comment in a bundle
Follow-up to Ifba218871122901031a891034e709b886fc406da.

Bug: T302014
Change-Id: If1572a3ff13e922d86c0eca3d252cb196d329ea7
2022-03-08 02:13:54 +00:00
Ed Sanders 6869112aad Use MessageWidget's showClose option
Change-Id: I81292bd84ce6feefdb852f6a636109f68e55291d
2022-03-08 01:25:22 +00:00
Translation updater bot 4460cd7fa9 Localisation updates from https://translatewiki.net.
Change-Id: Ifd2b7bb0429512a523a1a764dc625d9ba3f15cd6
2022-03-07 08:10:54 +01:00
Reedy 524c8edf5c Use namespaced EventLogging class
Change-Id: Ic9f11b12edb5da08c2f4b31bea2a6517737ee6af
2022-03-06 16:10:40 +00:00
Bartosz Dziewoński b2ee19b441 Remove check for CDATA nodes
Added in 76289cdf73,
should no longer be needed since we switch to Parsoid's
HTML parser in 3e6ab2c4d2.

Change-Id: Ic0b7ed8089b71f2338e604f68d547759e069f0b2
2022-03-04 22:14:41 +01:00
jenkins-bot d478371db3 Merge "Highlight new comments when refreshing" 2022-03-04 21:09:40 +00:00
jenkins-bot 80d0d6c78b Merge "Show error message as soon as we detect the parent comment has been deleted" 2022-03-04 21:09:37 +00:00
jenkins-bot a03db698db Merge "Don't show auto-save notifications when dynamically updating the page" 2022-03-04 21:09:35 +00:00
jenkins-bot 0c93b16c21 Merge "Poll for new comments in the section you are replying in" 2022-03-04 21:09:32 +00:00
Bartosz Dziewoński 0030f4cb9b Disable the biggest JS modifier test cases temporarily
Bug: T303074
Change-Id: I9bd284feb4ede27aadf99904fd230d9bfd778351
2022-03-04 20:22:11 +00:00
Translation updater bot 6b7ea63d24 Localisation updates from https://translatewiki.net.
Change-Id: I9767b557af29d5d7345252d7a411a5667ef057e2
2022-03-04 08:29:18 +01:00