Commit graph

713 commits

Author SHA1 Message Date
David Lynch 503d2f1f76 Enforce no text-indent on our reply button
Change-Id: Ie26d7632ec4845cc9048c0261b51ff2a1b6b51e2
2021-08-20 13:46:23 -05:00
jenkins-bot d77353d93e Merge "Remove unnecessary contentType: 'multipart/form-data' from an API query" 2021-08-19 16:32:08 +00:00
jenkins-bot 359b80ed70 Merge "When opening new topic tool using any link, always activate the link in page tabs too" 2021-08-17 15:51:29 +00:00
jenkins-bot 2cd97c4be5 Merge "Handle highlighting and scrolling to comments for bundled notifications" 2021-08-16 20:43:37 +00:00
Bartosz Dziewoński db28a3d3a7 Handle highlighting and scrolling to comments for bundled notifications
Notifications are bundled by section, so instead of linking to the
comment, link to the section.

Additionally, add a parameter to the URL listing all the comment IDs
from the bundle, and highlight them all and scroll to the topmost one.

Having to handle both URL fragments and URL query parameters makes
this code kind of a mess :(

Also, some unexpected changes became necessary:

* EventDispatcher.php: Store the section title in events using
  HeadingItem::getLinkableTitle() instead of ThreadItem::getText().
  The result is mostly the same, except in case of wacky markup like
  images or extension tags. We can more reliably use it to link to the
  section on the page, and we already use getLinkableTitle() when
  generating edit summaries in the reply tool for this reason.

* dt.init.less: Change the mix-blend-mode for the highlights from
  'multiply' to 'darken', so that multiple overlapping highlights do
  not look more opaque. This affects how the highlights look on
  non-white backgrounds and images (they're less blue, and on darker
  backgrounds entirely invisible), but it seems worth it.

Bug: T286620
Change-Id: I21bb5c003abc2747f0350d3f3af558dfb55693e9
2021-08-16 22:03:30 +02:00
Bartosz Dziewoński a129899971 Remove unnecessary contentType: 'multipart/form-data' from an API query
This was copied from somewhere else (probably VisualEditor), but it is
not needed here.

Using the multipart/form-data encoding is beneficial when sending long
binary data (such as the compressed HTML VisualEditor sends), and is
also required when uploading files, but it is not helpful when sending
a short query like we do here.

Also rename a variable.

Change-Id: I9bcce2ce1ca7c218e4cd147960d1070dd23ea9fa
2021-08-16 21:33:59 +02:00
David Lynch 642fede864 Apply design tweaks to empty states
Bug: T274831
Bug: T274832
Bug: T277329
Change-Id: I0dcdb3479ba668b78cf247856a8ec00d5ea37ab4
2021-08-11 14:33:43 -05:00
David Lynch 0cb756f248 Don't detach the reply widget when posting to an empty page
This will avoid a flash of the empty-state while we're reloading the
page to get new tabs.

Refactor out the new topic controller's clear behavior from its teardown
behavior, so we can still wipe out the storage when redirecting.

Bug: T288314
Bug: T288320
Change-Id: I6a5313b5e5b3bc9925e5cdaea04d8fbd3dc796af
2021-08-06 15:18:17 -05:00
Bartosz Dziewoński 7fcaae95b7 When opening new topic tool using any link, always activate the link in page tabs too
Bug: T288267
Bug: T277371
Change-Id: I1854c82853abf16d9552765df983b4490fcd4b30
2021-08-05 19:09:05 +00:00
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