Commit graph

790 commits

Author SHA1 Message Date
Bartosz Dziewoński ea68e1a8f0 Introduce CommentDetails to group up and document stuff we pass around
Change-Id: I809524ea8d89130548964ba9e5a73f00f6089ff4
2021-06-21 22:12:18 +02:00
Ed Sanders a76539e19b Disallow horizontal rule (----) in reply tool
These also don't work when indented.

Change-Id: Id2f1b14f434f8527f1391ebf056aeb80c7023feb
2021-06-17 21:30:48 +01:00
Ed Sanders 54f2dcf030 Unregister sequence help for unavailable commands
Bug: T284758
Change-Id: I85fe9332ec723e44b5cb508f9b53a59c9e9b61d9
2021-06-17 21:30:40 +01:00
Ed Sanders c41dab81c4 Reply tool: Disable preformatted command
Preformatted text can't be rendered in wikitext when indented.

Change-Id: I2269471dd76630661cdb459322df591c6b3e6a50
2021-06-08 23:02:59 +01:00
Bartosz Dziewoński c51638e940 Update surface styles for VE changes
The .ve-init-mw-target-surface class is no longer added since
Ic5320f6747907542285674d386c7a59c9e857f0a.

Also apply changes similar to I8d20a830dc48f6a098b0f9e9a7c7c1656de0fe56
to avoid potential styling issues with nested surfaces.

Bug: T284567
Change-Id: I58a49f0137e8804fbd73de20048eb2ffdbbfbe77
2021-06-08 18:04:21 +02:00
jenkins-bot c5c4c86185 Merge "Change how highlights are positioned to work better with unaware tools" 2021-06-03 12:11:25 +00:00
Ed Sanders 6a24ceaeca Subscribe/unsubscribe with plain text links
Bug: T279149
Bug: T279151
Change-Id: Ie7d46ea2e8d458fcdad4f91bb89ba038969f6b62
2021-06-01 20:37:47 +02:00
Bartosz Dziewoński 9c58c0a203 Change how highlights are positioned to work better with unaware tools
Previously, our highlights were placed in a node at the end of
the page, and positioned absolutely in relation to the whole
page. Now we insert the highlight in the DOM near the comment,
and position it in relation to that.

This way it remains positioned correctly when the page shifts
(e.g. collapsing the table of contents), and disappears when
the page content is hidden (e.g. opening visual editor).

Bug: T281471
Change-Id: I60afc4b94b2e23376105638542563e595a1811d9
2021-05-31 23:07:02 +02:00
Bartosz Dziewoński 90fdd12efd Swap DOM order of summary and watch checkbox
This is to achieve the same tabbing order as the wikitext editor.

Bug: T271773
Change-Id: I7e167ed8a5aa9b9862f215cba7539b7f79315037
2021-05-27 23:24:25 +02:00
Bartosz Dziewoński 7b21e29405 Follow-up: Adjust comment ranges to exclude the start marker *only*
The modifier crashes if endContainer is a <p>/<dd>/<li> node, and
it often is if we try to exclude the end marker from the range.
It doesn't matter for T281471, so let's just leave it that way.
(This is also more similar to the range produced by our parser.)

Follow-up to c4ba8e921a. No idea how
I missed this when testing that patch.

Also, improve comments.

Bug: T281471
Change-Id: If6aba34acf29c37d06fb0ca92547f78b58695597
2021-05-27 21:28:39 +02:00
Bartosz Dziewoński c4ba8e921a Adjust comment ranges to exclude the start/end markers
This produces nicer results when we call Range#getBoundingClientRect
on them later, when drawing comment highlights (using Firefox).

I'm not sure how this will affect everything in modifier, but it
doesn't seem to be causing issues. If it does cause trouble, then we
should instead adjust the range this way in controller#highlight.

Bug: T281471
Change-Id: I6f204b858990023f42f564cca7a2d24d322f872e
2021-05-27 15:19:08 +00:00
jenkins-bot 04df0fc9fb Merge "Highlight target comment when following a link or notification" 2021-05-26 19:46:56 +00:00
jenkins-bot 939810f8fe Merge "Change feedback link for new topic tool" 2021-05-26 18:59:28 +00:00
jenkins-bot ef413b73e6 Merge "Limit number of topic subscriptions per user" 2021-05-26 13:01:06 +00:00
Ed Sanders 2b3345af11 Change feedback link for new topic tool
Bug: T279400
Change-Id: I5d72552f45a63199c0fbb516dc94aef19945c95e
2021-05-26 11:27:01 +00:00
jenkins-bot e56a8ad756 Merge "Allow the widget to be squished next to floating elements" 2021-05-25 20:55:16 +00:00
jenkins-bot 90528f2b49 Merge "Fix adding comments in lists containing <dt> tags" 2021-05-25 19:19:49 +00:00
jenkins-bot 86732c56dd Merge "modifier: Guard against infinite loop" 2021-05-25 19:17:53 +00:00
Bartosz Dziewoński 0968d2203b Allow the widget to be squished next to floating elements
Bug: T278476
Change-Id: I8e997bbd9ee7bc50baf4e69bde2dda286505b006
2021-05-25 18:44:43 +00:00
Bartosz Dziewoński ee524d6bd6 Remove cookie hack for loading unavailable tools
Bug: T277783
Change-Id: I521db842b4b7a98d8d255d418abd0ccb167c5aa0
2021-05-25 20:27:46 +02:00
Bartosz Dziewoński 6a50d1203c Limit number of topic subscriptions per user
Per Manuel Arostegui in T263817#7033384. The limit is 5000.
(I picked it arbitrarily, there's no real rationale for it.)

Also log a warning when any user reaches half of the limit,
so that we might make a decision about changing this mechanism
before it starts affecting users. Maybe at that time we'll
have data to show that it's safe to remove the limit.

Bug: T263817
Change-Id: I18a8ee0ad7383759229c5721d5253fb591457d4d
2021-05-25 17:16:24 +02:00
jenkins-bot 3bea7fe77b Merge "Remove unused 'inTargetWidget' config" 2021-05-24 20:53:20 +00:00
jenkins-bot e8b51899a8 Merge "NewTopicController: Fix tag list construction" 2021-05-04 03:05:03 +00:00
Ed Sanders b4f72b7516 NewTopicController: Fix tag list construction
Bug: T279157
Change-Id: I2fa8042878d0f24385a8528ef0ba26bd4689a387
2021-05-03 18:42:16 +01:00
Ed Sanders 35e97c24fe Disable wikitext paste conversion in source mode
Bug: T280745
Depends-On: Icc716563e5536b4ef33a48ba10a72f3a39bdec35
Change-Id: I5875d8aa12dee694c3e5bd7e1a980da284343722
2021-05-03 14:52:19 +01:00
Bartosz Dziewoński db3c1b25cc Highlight target comment when following a link or notification
Bug: T281471
Change-Id: I8a5bca70d86364f3fade76f72d32d2bf1b9aaf37
2021-04-29 20:13:41 +02:00
Ed Sanders 799754a3cf Remove unused 'inTargetWidget' config
Change-Id: I713c3bdd80ec375e9683441c289ba22ed9b7057a
2021-04-29 15:46:26 +01:00
Ed Sanders e995332d77 Fix eslint doc type warnings
Change-Id: Iaadc500609db3b462ef8de663f7ec34f46dc0434
2021-04-27 22:52:11 +01:00
jenkins-bot 60e1fa334f Merge "Remove deprecated dt- classes" 2021-04-23 17:35:51 +00:00
Bartosz Dziewoński 534f907d33 Fix topic subscriptions button
Follow-up to a3f665e816.

Change-Id: I4df324bb6b60a0a840ddfe483aa10143e218bdf8
2021-04-22 20:43:02 +02:00
Ed Sanders eae0c1e6e1 Implement hidden tag for source mode with toolbar
Bug: T279157
Change-Id: I0244530580c7243e4db33848d36c336d8e5e8a08
2021-04-22 17:44:00 +00:00
Ed Sanders 1893405635 Code style: Move var declarations inline
Change-Id: I1686603388b050ba4ec22eff23e4806cdf262b87
2021-04-22 17:43:46 +00:00
Bartosz Dziewoński ffd680ee7f Fix adding comments in lists containing <dt> tags
The issue occurred when replying to a comment consisting of multiple
list items, starting with a <dt> (instead of the expected <dd>), so
that the comment is considered to be unindented.

Modifier tried to add the reply directly inside the list (<dl>) rather
than inside the last list item (<dt>), which caused it to be confused
about indentation levels and try to un-indent more times than there
were indentations.

The simplest solution, given the existing code, is to add the reply
outside the list instead, in a new list. This results in a "list gap"
(<dl><dt>...</dt><dd>...</dd></dl><dl><dd>...</dd></dl>), but I think
it's acceptable for this rare case.

There are separate tests cases for old Parser and for Parsoid HTML,
because they parse the original wikitext differently (with the old
Parser producing HTML with a list gap too).

Bug: T279445
Change-Id: Ie0ee960e7090cf051ee547b480c980e9530eda51
2021-04-21 16:00:07 +02:00
Bartosz Dziewoński f6b7c69736 modifier: Guard against infinite loop
If curLevel or desiredLevel are calculated incorrectly, this loop
could never end.

In JS, something would throw an exception before going infinite, but
PHP is happy to trot along despite accessing properties of null and
attaching multiple children to a document node.

Bug: T279445
Change-Id: I1784f550ec3a23dcded4f2b1def97e51cb414b7b
2021-04-21 13:43:45 +02:00
Bartosz Dziewoński 4bbfe6cb5d Rename CommentFormatter::addReplyLinks
Bug: T280351
Change-Id: I0d7627d63407e11cca6091f78e4d440eec6efa91
2021-04-21 11:24:03 +00:00
Bartosz Dziewoński a3f665e816 Remove <header> tags around headings for compat with MobileFrontend
We added it because the initial designs for the subscribe action were
much easier to implement like this, and topic "containers" (T269950)
would have required it.

However, the latest design of the subscribe action will not need it
(T279149), and topic containers are still very far away, so let's
remove it for now.

Bug: T280433
Change-Id: I21a23e9bea43f24d265750926fbd62b99038d3f1
2021-04-19 17:47:43 +02:00
jenkins-bot ab41904d91 Merge "Migrate cookie hack users to beta feature" 2021-04-16 12:23:41 +00:00
jenkins-bot 58fc1753fe Merge "Include comment names in 'transcludedfrom' API response" 2021-04-16 11:30:22 +00:00
Bartosz Dziewoński 2352fefb58 Migrate cookie hack users to beta feature
Bug: T277783
Change-Id: I455cab2acd0729b1c117b65cc1ede0ad9eb651cf
2021-04-14 20:36:32 +02:00
Bartosz Dziewoński 6bf75b4752 Fire the 'wikipage.content' hook on previews
We already fire it after saving the reply/topic.

Bug: T279141
Change-Id: I4ecbea877035f61d9642dded9ca54e5bff795099
2021-04-08 21:38:45 +02:00
Bartosz Dziewoński bfe6a36514 Include comment names in 'transcludedfrom' API response
As of 7ad6328223, we also use this data
to check whether comments exist on the page, not only whether they're
transcluded.

Follow-up to 42ce942c86.

Bug: T275821
Bug: T273413
Change-Id: I95eb85354e7b84cc10ab703d28315d0667696f4c
2021-04-07 22:46:36 +02:00
Ed Sanders eb7e682d2f Topic subscription front end
Bug: T276996
Change-Id: Ifb62c04c2a0ea8399749b22021d6a1c5a079bf94
2021-04-06 23:28:28 +02:00
jenkins-bot f702e094a8 Merge "Remove compatibility code for 'data-mw-comment-start' change" 2021-04-06 13:48:19 +00:00
jenkins-bot 9bf9977369 Merge "Fix switching interface getting stuck after failing to switch" 2021-04-03 12:59:21 +00:00
Ed Sanders 4c27187500 Make the source mode toolbar a user preference feature
Bug: T275950
Change-Id: I099af342f378215c68092d165dd88de1807d29d2
2021-03-31 22:40:53 +02:00
Bartosz Dziewoński 5dae22e93a Fix switching interface getting stuck after failing to switch
Follow-up to 58c078437d.

Bug: T274423
Change-Id: Ie410b61e2b64d9ef2bb20d5df9f95d2c90392323
2021-03-29 21:22:07 +02:00
jenkins-bot 4e956d11b9 Merge "ReplyWidget: Separate out switching logic into switch method" 2021-03-29 19:17:27 +00:00
jenkins-bot c27071a2e7 Merge "Check if you can edit the page before opening the tools" 2021-03-25 22:11:38 +00:00
Bartosz Dziewoński 253da36101 Check if you can edit the page before opening the tools
The information is already included in the VisualEditor metadata request.

Bug: T276393
Bug: T270803
Change-Id: I45a232dcd23418da0711834bcc369a9a718006b0
2021-03-25 17:04:31 +01:00
jenkins-bot 151e9ca79b Merge "Trim wikitext for preview" 2021-03-24 22:02:58 +00:00
jenkins-bot 027f8983a2 Merge "modifier: Fix whitespace trim inconsistency" 2021-03-24 22:02:57 +00:00
jenkins-bot c2ebb93d8a Merge "ReplyWidget: Defer scrollElementIntoView" 2021-03-24 20:00:58 +00:00
jenkins-bot b023f59e53 Merge "UsernameCompletion: Use ve.ce.Surface.findMatchingSequences" 2021-03-24 18:21:43 +00:00
jenkins-bot a2c8a2ca4d Merge "Don't insert multiple '@' when clicking the mention toolbar button multiple times" 2021-03-24 18:13:34 +00:00
Ed Sanders 86fe745724 UsernameCompletion: Use ve.ce.Surface.findMatchingSequences
Depends-On: I7a9b9abaa5a518f21f9965a16803e0a4c82b436f
Depends-On: I48e1137150dee024ebdc96f0e780a88bff6b8177
Change-Id: I06d31694c9fddb3795e61dccecf812b7e1a783b2
2021-03-24 17:56:20 +00:00
Bartosz Dziewoński 566d4d92db Trim wikitext for preview
And change some uses of trim() to htmlTrim() for consistency.

Bug: T276612
Change-Id: I1f55f4793af8f3dda597288c9e3427abe31c37c9
2021-03-24 18:53:41 +01:00
Bartosz Dziewoński 3ac540af95 modifier: Fix whitespace trim inconsistency
The JS and PHP trim() methods remove different characters.

Change-Id: I8ae5526ea5033e345b6a6b63ea447c394956d988
2021-03-24 18:53:21 +01:00
Ed Sanders 822472a6ec ReplyWidget: Separate out switching logic into switch method
Keep implementation-sepcific modeTabSelect handling in
modeTabSelect event handler.

Change-Id: I183bc80eb9f0e2a69aa30e5de82026983e3006be
2021-03-24 14:09:09 +00:00
Ed Sanders d5450abe39 ReplyWidget: Defer scrollElementIntoView
Prevents VE from cancelling this scroll, and so not full scrolling the
widget into view.

Change-Id: I5b242fa2c60b87a52935f86f95d6c0efde2b74bc
2021-03-24 12:59:25 +00:00
Bartosz Dziewoński 3e723f5310 Don't insert multiple '@' when clicking the mention toolbar button multiple times
Bug: T275906
Change-Id: I7a4e914b8ae491de240efa97c7f001b57c9d8acc
2021-03-24 11:08:19 +00:00
Bartosz Dziewoński 42ce942c86 Introduce comment "names" to identify comments across revisions/pages
The existing comment IDs can't be used to find the same comment on
a different revision or page (when it's transcluded), because they
depend on the comment's parent and its position on the page.

Comment names depend only on the author and timestamp. The trade-off
is that they can't distinguish comments posted within the same minute,
or in the same edit, so we will still need the IDs sometimes.

Prefer using comment names when replying, if they're not ambiguous.
This fixes T273413 and T275821.

Heading names depend on the author and timestamp of the oldest comment.
This way we don't have to detect changes to the heading text, but we
can't distinguish headings without any comments.

Bug: T274685
Bug: T273413
Bug: T275821
Change-Id: Id85c50ba38d1e532cec106708c077b908a3fcd49
2021-03-23 16:08:42 +00:00
Ed Sanders b0a94405dc Remove deprecated dt- classes
Change-Id: I4fb59f187bf3e31fd9c31841576b3f69aec23634
2021-03-23 12:39:34 +00:00
Bartosz Dziewoński 9e255d82ca Remove compatibility code for 'data-mw-comment-start' change
No longer needed.

This reverts commit f727c988a0.

Change-Id: Ib67d30890c6542bd0235dac6e49870c038d5dd86
2021-03-22 21:17:34 +00:00
Bartosz Dziewoński f727c988a0 Fix "TypeError: Cannot read property 'hasAttribute' of null" when loading on cached pages
Follow-up to c4de603ef9.

Change-Id: I05dfb142e95e02715b56c2bd7c73bcfbb342fbfe
2021-03-22 21:06:34 +01:00
jenkins-bot 536f50c293 Merge "Give comments IDs so they can be scrolled to with hash links" 2021-03-22 12:40:06 +00:00
jenkins-bot abb14d091a Merge "ReplyWidget: Hide external links icons in the anon warning" 2021-03-20 17:41:36 +00:00
jenkins-bot c0b221126d Merge "Add accessibility labels to a few controls" 2021-03-20 16:50:33 +00:00
jenkins-bot 9d65658858 Merge "Improve mode selector keyboard interactions" 2021-03-20 16:50:31 +00:00
jenkins-bot 74980b78b5 Merge "Ensure ReplyWidgetVisual#getMode always returns a mode" 2021-03-20 16:39:49 +00:00
Ed Sanders c4de603ef9 Give comments IDs so they can be scrolled to with hash links
Bug: T265268
Change-Id: Idb985ed38bdb74e23cb7840899a61dc919f05f6f
2021-03-20 15:43:23 +00:00
Ed Sanders 4a0802065c Make IDs (to be used as URL hashes) wikitext safe
* Use hyphens instead of pipes a separators
* Use underscores for spaces in usernames

Change-Id: I6efd9739fc73e45002e50e64c43ce0de1c2f1239
2021-03-18 20:45:21 +01:00
Bartosz Dziewoński 9da3949c47 Add accessibility labels to a few controls
Topic title field and old wikitext reply field had only placeholders,
but no labels.

Mode selector had labels on individual items, but not on the main
control.

Change-Id: I422e7e5baa8711340a1bb82255e788f2272c45c9
2021-03-18 15:15:40 +01:00
Bartosz Dziewoński 58c078437d Improve mode selector keyboard interactions
When there are just two modes, using arrow keys to switch between
them is not intuitive. The focus moving from the selector to the
body widget afterwards is even less intuitive.

Override default TabOptionWidget to allow options to be highlightable
(not just immediately selectable), and mark the current mode's tab as
disabled instead of selected (but make it look selected).

This results in intuitive keyboard interactions (tabbing to the widget
highlights the other tab rather than the current one, pressing enter
switches to it).

Bug: T274423
Change-Id: I9d358d5f301cbf081380ef5d34ccc8c4e146652e
2021-03-18 15:15:40 +01:00
Bartosz Dziewoński 1dbe907011 Ensure ReplyWidgetVisual#getMode always returns a mode
In some situations we didn't pass the mode in the config.

Simplify some redundant code that got messed up when we
introduced the NWE source mode.

Change-Id: Ia838fc6752d411f70c8cc6a36d84d2a851fd68bd
2021-03-18 15:15:40 +01:00
Bartosz Dziewoński 522b7932d7 ReplyWidget: Hide external links icons in the anon warning
Similar to 282c987efa.

Change-Id: I0f6ca2d4aef114d7c8853df19140bbd27c20325a
2021-03-17 15:50:34 +01:00
Ed Sanders ece8ff69ff Change dt- class prefix to ext-discussiontools-
Longer, but follows the style guide and less likely to conflict.

We need to account for init classes in the cache being around for
a while.

Change-Id: I738bc93393850db320fdbda2b003ca8ac40556da
2021-03-13 14:42:39 +00:00
Bartosz Dziewoński 1a52f06daf Tweak signature formatting in previews for more accurate results
When posting a new topic, if your comment ends with a template
that has trailing line breaks, the signature will be added as a
preformatted text (which is arguably a bug: T255741).

Preview, however, did not reflect this bug, because of the <span>
markup added to fade out the automatic signature.

Change-Id: I062b01a035e22edfca752a49c5e2433b3f7fb4f6
2021-03-09 01:08:59 +01:00
Bartosz Dziewoński 44f2209abf Trim signatures when added in an empty existing node, too
Add unit tests for appendSignature().

Bug: T276612
Change-Id: Ic44c52f4d54492e092f9396c626380e2637b6f0f
2021-03-08 23:38:46 +00:00
Ed Sanders 5324e60e84 Tracking changes from VE source mode
Change-Id: I5cafa7a21a0ab90fab9d09e44b7525ee07f56709
2021-03-08 21:13:10 +00:00
jenkins-bot 17a3657b6a Merge "Follow-up I60e550ef: Don't show relevant user in mention list if it is you" 2021-03-04 22:09:57 +00:00
Ed Sanders 45cda20cf3 Don't attempt to put comment markers in <noscript> tags
Bug: T276455
Change-Id: Ia427d97528b137111145ac79680972a660f28e37
2021-03-04 22:24:04 +01:00
Ed Sanders 998bd206ae Follow-up I60e550ef: Don't show relevant user in mention list if it is you
We have logic above to exclude mentioning yourself, but this
is overridden if you are commenting on your own talk page.

Change-Id: I2858c79bd9f1cb733f105825e17f9df75859e40a
2021-03-04 20:59:00 +00:00
jenkins-bot 3dc27a73b0 Merge "Don't detect comments within 'cite' elements too" 2021-03-02 23:50:14 +00:00
Bartosz Dziewoński f5059e6ea6 Don't detect comments within 'cite' elements too
Follow-up to 024a978ffd.

Bug: T275881
Change-Id: I53448ad22cd0531e7fd4aa0ea5d15782879cce14
2021-03-01 21:40:43 +01:00
jenkins-bot 78260b97fe Merge "Ensure most of the widget doesn't move when blur-validating" 2021-03-01 20:39:06 +00:00
jenkins-bot 6650eb56cd Merge "Fix toolbar dialog placement" 2021-03-01 19:59:39 +00:00
jenkins-bot f1d5a75f84 Merge "Pass replyWidget to target" 2021-03-01 19:59:38 +00:00
jenkins-bot 0eb37a87df Merge "Don't detect comments within quotes" 2021-02-28 22:56:20 +00:00
Bartosz Dziewoński 024a978ffd Don't detect comments within quotes
Bug: T275881
Change-Id: I8f7a4279837bd95ebf5b604ff350c0a3f29c2c05
2021-02-28 22:49:48 +00:00
Ed Sanders 665f68f838 Fix toolbar dialog placement
There are no available tools that use this, but it
can be tested using:

ve.init.target.surface.executeCommand('specialCharacter')

Change-Id: I853e6a3b9bd3caff018b6fe22cea9b1c6a428dff
2021-02-28 22:18:58 +00:00
Ed Sanders f5c3da2a86 Pass replyWidget to target
This allows the target to access $headerWrapper directly
instead of using flaky DOM traversal.

Change-Id: I81f6616ea8fa7cbfb58e576fd5b2739c6158a216
2021-02-28 22:07:51 +00:00
Ed Sanders c04a4c5c8f Ensure most of the widget doesn't move when blur-validating
This ensures click events are interrupted on other controls.

Bug: T275923
Change-Id: Ib73d17a965f1fb7e2bc4870bdbb568a9f6d071d3
2021-02-28 15:00:12 +00:00
jenkins-bot 8bb5eea999 Merge "Improve signature detection to handle formatting on the timestamp" 2021-02-27 22:54:50 +00:00
jenkins-bot c5874422df Merge "CommentUtils: Fix edge case bug in getCoveredSiblings()" 2021-02-27 22:54:46 +00:00
jenkins-bot 49938a88dc Merge "Improve merging multiple comments on one paragraph" 2021-02-27 22:54:43 +00:00
Ed Sanders f62ce55671 Fix wikitext command registry inheritance
This fixes some missing commands in source mode, such as undo.

Change-Id: Ie470bd351e2fd67bcbb8cc839e70c3efcaaf1564
2021-02-27 18:24:36 +00:00
Bartosz Dziewoński efe95494a8 Improve signature detection to handle formatting on the timestamp
Now it detect signatures generated by en.wp's {{Undated}} template,
and signatures of people who do weird stuff to the timestamps.

Bug: T275938
Change-Id: I27b07f6786ca5433a3c02a5fe68e4716d41401bb
2021-02-27 02:33:30 +01:00
Bartosz Dziewoński e767ee1741 CommentUtils: Fix edge case bug in getCoveredSiblings()
In some cases it would return the parent node, instead of the siblings
it should return.

It's a private method only called by getFullyCoveredSiblings(), and
that method had a bug that cancelled out this one, so everything
worked correctly. But I want to use it elsewhere now and ran into it.

Change-Id: Ic12f007d57a8502a1bea5f0af17b29e9d59093d6
2021-02-27 02:26:42 +01:00
Bartosz Dziewoński af082908a5 Improve merging multiple comments on one paragraph
The horrendous 11-line if() condition did not correctly handle
signatures wrapped in inline formatting markup, like <small>.

Instead, implement this logic in the code for skipping to the end
of a paragraph, which didn't exist yet when that condition was
added, but seems like a much better place to check this now.

Bug: T275934
Change-Id: I5cccff889b5e15b5f8fde0538bf4bccb22e762cf
2021-02-27 02:21:36 +01:00
Ed Sanders 01ac28540a Support the enable2017Wikitext option
Bug: T257391
Change-Id: If2511609035c26063203512f4b860bd0060e08af
2021-02-26 19:13:54 +00:00
jenkins-bot c4759bdcb1 Merge "CommentParser: Replace getThreadStartTimestamp with getThreadStartComment" 2021-02-24 16:46:56 +00:00
Bartosz Dziewoński 444e5deb62 Make sure the Visual/Source mode selector loses focus after switching
Bug: T274423
Change-Id: Icfa4d435e4cb0ecab123c5fbdb68f23ecde99b5f
2021-02-24 12:32:14 +00:00
Bartosz Dziewoński 35738b1f9b CommentParser: Replace getThreadStartTimestamp with getThreadStartComment
Change-Id: Ia8d878594306b5ce4039ca06d6dcec753e5dea28
2021-02-24 12:26:58 +00:00
David Lynch 6ec1f39147 Change generation of logging session ID
Same pattern as is now used in VisualEditor. Generate an initial session
ID when the file loads, so if any VisualEditorFeatureUse events trigger
before the init there'll be a session ID for them to use.

Bug: T275051
Change-Id: I4f25e9e1e195c11129044868eb67fcc2f4494ffd
2021-02-23 15:37:22 -06:00
Ed Sanders da72fb15c2 Only show reply links when body class in present
Bug: T273072
Bug: T274311
Change-Id: Ibe08c0eba0b80a5143845dcd1792d616ad8ffc61
2021-02-23 19:36:21 +00:00
jenkins-bot f6cb81ce21 Merge "Show wikitext warnings for sequences not in reply tools" 2021-02-19 00:27:12 +00:00
Ed Sanders 6afb92d940 Show wikitext warnings for sequences not in reply tools
Bug: T274923
Change-Id: I56adc6524398805d3d6d582572e7524af8ba86a7
2021-02-18 22:52:35 +00:00
Ed Sanders 33c6181e79 Rename indent replacement methods
Change-Id: I8cb1b58dad068be7cfa62cab9e932463a23c6b12
2021-02-17 23:42:57 +00:00
jenkins-bot c417d3279a Merge "Make new topic autosave specific to page title" 2021-02-17 23:26:36 +00:00
jenkins-bot 872867c422 Merge "Fix highlight when new topic is posted without a title" 2021-02-17 23:26:34 +00:00
Bartosz Dziewoński 717955a513 Make new topic autosave specific to page title
Bug: T274949
Change-Id: I7e1bbcd6c606c7443f55fe3b1780021b07b28c5e
2021-02-17 20:09:13 +00:00
Bartosz Dziewoński b7917f5fa4 Fix highlight when new topic is posted without a title
Bug: T272666
Change-Id: I9bf87d6e6e004001fa387e94623751eea694a14f
2021-02-17 21:08:54 +01:00
Bartosz Dziewoński 9ae59e6ddb Disable VE indentation commands to allow tabbing out of the widget
Bug: T172694
Change-Id: I458271a82a2aba475007d94901bd14f405bccb24
2021-02-17 19:30:23 +00:00
Bartosz Dziewoński 1998c983f1 computeId() can't return null
It used to return null for headings, but now it doesn't. Simplify some
code checking for that.

Change-Id: I28131c4aee89b901879b4c49953d6b15ed91b5e7
2021-02-13 00:08:15 +01:00
jenkins-bot f393fa5f03 Merge "Remove a TODO note about wrappers" 2021-02-11 00:09:50 +00:00
jenkins-bot d5b2389ffa Merge "Fix replying outside wrappers for partially indented comments" 2021-02-11 00:09:48 +00:00
Ed Sanders b581883e7c Show relevant user in local suggestions on user talk pages
Bug: T273324
Change-Id: I60e550efbea3d9e250dcaf13080407094a23aad3
2021-02-09 21:51:28 +00:00
Bartosz Dziewoński 3a1b8e09ea Remove a TODO note about wrappers
Yes, this is still needed, removing it causes failures in tests
(and the old outputs look better).

Change-Id: I5bcedb0295a1f0ac4f6e51eaa9a9e072d8236f3c
2021-02-08 22:23:54 +01:00
Bartosz Dziewoński 9d2b35828d Fix replying outside wrappers for partially indented comments
Top-level comments that start or end with a list (inconsistent
indentation) would not have triggered the logic for detecting
wrappers.

Bug: T273692
Change-Id: Idcb4eed73e391f5f86eca2eb05cb3cea0d86f30a
2021-02-08 22:18:37 +01:00
jenkins-bot 3da91953da Merge "Adjust new comment highlight timings" 2021-02-08 18:51:06 +00:00
Bartosz Dziewoński 3c7c9c6e3a Adjust new comment highlight timings
The new timing exactly matches MediaWiki's post-edit notification.

Bug: T268994
Change-Id: I8233f56ad6e0d95285fee7f514fce914e7897905
2021-02-08 16:49:50 +01:00
Ed Sanders d05109b24d Truncate user generated part of IDs to 80 characters
This ensures that IDs fit in a 255 character database field.

Bug: T273658
Change-Id: I3cfe4fce6a865b4343f0f01121cd696aa5f98b22
2021-02-03 15:04:58 +00:00
jenkins-bot 63a5916e53 Merge "Update warning about missing topic title immediately" 2021-02-02 12:11:21 +00:00
Ed Sanders 6c3dd3aaa9 Move Hooks to HookUtils
Now that all the real hooks have been separated out

Change-Id: Ibdb42f98614fc551068f8f8e5297dcc99251ab46
2021-02-01 22:35:11 +00:00
jenkins-bot fb415e374d Merge "Update 'save_failure_type' map for EditAttemptStep schema" 2021-02-01 18:28:13 +00:00
Bartosz Dziewoński 069050ad12 Update warning about missing topic title immediately
Since it's no longer tied to the "Reply" button, we can move the code
from ReplyWidget to NewTopicController, where it belongs.

Bug: T272543
Change-Id: I8c90ffb772573d22d26c608d45877ee948fd232d
2021-01-29 23:14:45 +01:00
jenkins-bot 50f749d676 Merge "Handle category links at ends of comments affecting indentation" 2021-01-26 17:21:34 +00:00
jenkins-bot 373282dfb4 Merge "Don't show error message popups when failing to restore auto-save" 2021-01-26 17:21:32 +00:00
jenkins-bot 2b648dad64 Merge "CommentController: Even better handle clicking links while already commenting" 2021-01-26 17:04:04 +00:00
jenkins-bot 76da6af031 Merge "Move some setup code from CommentController to controller.js" 2021-01-26 17:02:22 +00:00
Bartosz Dziewoński c781b127c9 Handle category links at ends of comments affecting indentation
* Ignore rendering-transparent nodes between discussion comments.
* Improve isRenderingTransparentNode() so that <link> nodes
  representing TemplateStyles are not considered transparent,
  otherwise this would undo ae920b831f.
  Using a regexp from Parsoid.

Bug: T272746
Change-Id: I0b3c3251156ba6c4826abf5ba44ea93f80ebc01d
2021-01-26 04:55:03 +01:00
Bartosz Dziewoński 344038ae41 Don't show error message popups when failing to restore auto-save
Several of the messages talk about clicking the reply links, which
seems unhelpful. Also, showing a fullscreen popup on page load seems
very unhelpful too. (Itoldyouso that we shouldn't use popups.)

Bug: T268069
Change-Id: Id1312cf06200fb45a28b39481a99cc2c96603fa4
2021-01-26 03:03:19 +00:00
Bartosz Dziewoński d354b34fa6 CommentController: Even better handle clicking links while already commenting
If the user is clicking on a new topic link, and a reply widget is
open, attempt to close it instead of doing nothing.

Bug: T272545
Change-Id: I1903f5ae4c9e98c4b3a4703ad0e44d772894592a
2021-01-25 23:42:15 +01:00
Bartosz Dziewoński 718457130e Move some setup code from CommentController to controller.js
We'd like the [reply] links to behave differently if other
CommentControllers are already active, but each CommentController
doesn't know anything about others; only the main controller.js does.

Change-Id: Ic21b2d40d213a325509822f703709f52aa8dc8d7
2021-01-25 23:33:58 +01:00
Bartosz Dziewoński 60272fc348 Fix cookie loading hack
If the module is loaded on a page where DiscussionTools is
not supposed to be enabled, wgDiscussionToolsFeaturesEnabled
will be undefined, and the code will crash before it can set
the cookie that enables it for future page views.

Bug: T272850
Change-Id: Ia1c40cfc3cbee62823f1806bd20229883905677a
2021-01-25 15:17:20 +01:00
jenkins-bot 7bf858066f Merge "NewTopicController: Clear section title on teardown" 2021-01-20 00:31:07 +00:00
jenkins-bot e0fafcee3d Merge "CommentController: Better handle clicking links while already commenting" 2021-01-20 00:28:11 +00:00
Bartosz Dziewoński 2337600f38 NewTopicController: Clear section title on teardown
Bug: T272393
Change-Id: I633adc17c18e50b921400ec2fcab57649da147dc
2021-01-20 00:23:10 +00:00
jenkins-bot 1c9f038aac Merge "Padding and border around new topic tool" 2021-01-20 00:04:31 +00:00
jenkins-bot 8d999c5ebf Merge "Separate dialog for abandoning a new topic" 2021-01-20 00:04:29 +00:00
Bartosz Dziewoński 37b574f165 Separate dialog for abandoning a new topic
Bug: T269190
Change-Id: Ie4f486b0641edea369702631556d8ea31f991370
2021-01-19 21:40:21 +01:00
Bartosz Dziewoński 2798ee73f4 CommentController: Better handle clicking links while already commenting
Bug: T272389
Change-Id: If28a6cce250dca4810de3f51c0a2a4587d00649e
2021-01-19 21:21:47 +01:00
Bartosz Dziewoński 9ee2341310 Fix skipping past our own reply buttons for wrapped comments
Bug: T272318
Change-Id: I7c80a0be3af76d4db19f9934c5869be07e4bc52c
2021-01-18 20:42:23 +01:00
jenkins-bot e17467b09c Merge "Fix exception when trying to use non-existent 'typeof' attribute" 2021-01-18 18:58:35 +00:00
Bartosz Dziewoński 8f42c74985 Fix skipping to the end of paragraph, now it considers nested tags
Add yet another tree walking utility: CommentUtils::linearWalk().
Unlike TreeWalker, it allows handling the beginnings and ends of nodes
separately – kind of like parsing a XML token stream, or kind of like
VisualEditor's linear model.

(Add unit tests for this utility. The simple.html test case is copied
from [VisualEditor/VisualEditor]/demos/ve/pages/simple.html.)

Use this utility to stop skipping when we reach either a closing or
opening block node tag. Previously we'd skip over such tags inside
nested "transparent" nodes (like <a>, <del>, or apparently <font>).

Bug: T271385
Change-Id: I201a942eb3a56335e84d94e150ec2c33f8b4f4e0
2021-01-18 18:20:20 +00:00
Bartosz Dziewoński 1fa9a020ad Update 'save_failure_type' map for EditAttemptStep schema
Remove unused error codes, update the ones that changed, and sort in
the order in which the types are listed on the schema page.

Bug: T272162
Change-Id: Ib16f7e11ff81d43443b08cf704ce5196420671e4
2021-01-15 19:54:45 +01:00
Bartosz Dziewoński c20e7765ea Fix exception when trying to use non-existent 'typeof' attribute
Bug: T272090
Change-Id: I4d1e7457441f28d789dec8b7fd2dc3ba10fd995e
2021-01-14 22:11:32 +01:00
Ed Sanders c42e86f0f6 Config: Explicitly check feature availability in the client
Don't assume a feature is available because the code has
loaded and the user option is set. Export the logic from
Hooks.php to the client.

Change-Id: Ica0e58de7ed0d59e3b09645193eb2b691ae41c39
2021-01-14 19:04:18 +00:00
Ed Sanders e16a519a05 Padding and border around new topic tool
Bug: T269157
Change-Id: I4f56f9dc0eca71ea4ed452df49e861aac47e3de8
2021-01-13 20:54:59 +00:00
David Lynch 27a995d5a2 A/B test bucketing for beta enrollment
If DiscussionToolsABTest is enabled (set to `all` or a feature), logged
in users who have never used the tool before will be assigned to an a/b
test bucket. If they're in the test bucket, they get the feature
enabled.

If they manually set their beta feature preference, we don't override
that but do maintain their bucket for logging purposes.

Bug: T268191
Change-Id: I9c4d60e9f9aaef11afa7f8661b9c49130dde3ffa
2021-01-13 10:32:00 -06:00