Commit graph

704 commits

Author SHA1 Message Date
David Lynch 91af0594b5 Apply an empty-state to pages with the new topic tool enabled
This includes the dtrepliedto URL functionality from
I3f81e4d77faed367606e47678b8896051982359d.

Bug: T274831
Bug: T274832
Bug: T277329
Change-Id: I035d04f30c8312b0cb42902d3bf940df1482ffb3
2021-08-04 18:46:28 -05:00
jenkins-bot d4f4e49c7e Merge "Allow the new topic tool to handle URLs like action=edit&section=new" 2021-08-03 16:14:21 +00:00
jenkins-bot 1f4706a308 Merge "Recognize links to add a new topic that use Special:NewSection" 2021-08-02 17:42:30 +00:00
Bartosz Dziewoński cfbf437d9d Allow the new topic tool to handle URLs like action=edit&section=new
Depends-On: Ib9302e2fda7dadf1edc43c0107db7234eb4bdf7a
Depends-On: Ic7dd677ea219938969f60bab91387c2e03ebdbe6
Bug: T282204
Change-Id: I2e7b2682da7beb3c1c469bb784a9a8ec3998aeb9
2021-07-30 09:25:21 +02:00
jenkins-bot e9ff4695ad Merge "Change updating page content after saving to avoid losing footers" 2021-07-28 16:59:05 +00:00
Bartosz Dziewoński 4ebf05d802 Recognize links to add a new topic that use Special:NewSection
Bug: T277371
Change-Id: I40a13d8bf87bcd3ecea1427b444b6b7b621213c4
2021-07-22 22:25:11 +02:00
Bartosz Dziewoński 4e8e1bda67 Change updating page content after saving to avoid losing footers
This is the same method as used by VisualEditor
(ve.init.mw.DesktopArticleTarget.prototype.replacePageContent).

Bug: T275698
Change-Id: Idcf7c79b8d5565b0ae36c6e9d42b66662c1acc8d
2021-07-22 21:43:10 +02:00
Bartosz Dziewoński 709a7e5c4a Do not teardown newtopictool interface if it was not setup
Bug: T287035
Change-Id: Ib7c6c564ff197e0c8c8cf79680513f9415d108f9
2021-07-20 22:32:25 +02:00
Bartosz Dziewoński b3a2941575 Remove comment highlight after user clicks anywhere on the page
Bug: T285430
Change-Id: I32fc04a440c807211c5e4f121e58757466ee55bf
2021-07-13 02:38:40 +02:00
Bartosz Dziewoński 650c7dd1d3 Avoid exception when trying to highlight hidden comment
(e.g. if the comment is inside a node with 'display: none')

Change-Id: I23a38fd877b1f9f1554962f7f08f7e2732d8f560
2021-07-13 00:00:30 +02:00
Bartosz Dziewoński f35bf487ef Take over extra links to add a new topic added by gadgets/templates
* Move getTitleFromUrl() from parser to utils. It's a generic method,
  the PHP equivalent is already in utils.

Bug: T277371
Change-Id: Id960e5f60af02bdeb0a3a68f43b7a695eb035139
2021-06-30 18:06:39 +02:00
Bartosz Dziewoński dce09e61b7 Improve how new topic tool avoids conflicts with NWE new section
I noticed that the NWE new section editor would open sometimes even
though we attempt to prevent it. This way seems to work more reliably.

Change-Id: I0ce1640b8c1dd098bf3f0d41dc4fdc276a0c5fd5
2021-06-30 18:00:34 +02:00
Bartosz Dziewoński a2c662d3b2 Move reply link handling out of CommentController
Problems with the current setup:

* Each CommentController must have exactly one link.
  For T277371 we want multiple, and for T282205 we might want zero.

* CommentController objects must be constructed immediately.
  They are implemented to make this pretty fast, but it's still
  unnecessary work to do on page load.

* Only one link may be activated at a time, and activating one affects
  the styling of others, so CommentController has to use global state
  to check if it can set up and to update them.

Instead introduce ReplyLinksController, which knows about all reply
links and which one is active, and emits events that allow
CommentControllers to be constructed on demand.

Change-Id: Iabdeded2e71e598ae78703a6ff9410d0cfba397c
2021-06-30 17:05:55 +02:00
Bartosz Dziewoński a36d6ad5c6 Show edit notices in the new discussion tool
Considerations:
* Using the same edit notices as VisualEditor, except 'anoneditwarning'
* No extra frame/styling is added (on Wikimedia wikis, the notices
  often already have them)
* 'talkpagetext' message is not shown (on Wikimedia wikis, they are
  mostly about signing your posts with tildes, which is not necessary)

Bug: T269033
Change-Id: Idc5ff29f093c75a14c3a3479888295d5bf630f6d
2021-06-22 21:40:51 +02:00
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