Commit graph

181 commits

Author SHA1 Message Date
Ed Sanders 640638b1dc ReplyWidget: Document all methods
Change-Id: Iab509a7605c3b8e25bcc20fb7176fed23409aed4
2021-12-20 15:59:47 +00:00
Bartosz Dziewoński 72f806829c Ensure form tokens are not longer than allowed
Bug: T295940
Change-Id: I4e3fd5d3ef21274b104c4d22e3bab11043d61334
2021-11-17 23:53:38 +01:00
Bartosz Dziewoński 2d5af9608a Fix saving edit mode on mobile in reply tool
When this code was added in 5feb69612f,
it was inside the `if ( this.modeTabSelect ) { … }`, because switching
was an experimental option and could have been unavailable.

Switching is always available now, but the `modeTabSelect` widget
doesn't exist in the mobile version (because switching interface is a
part of the toolbar there), so this line should be outside the `if`.

Bug: T270536
Change-Id: I7c5959281e77558bfe82bd39d38ba4dda36d590c
2021-11-04 18:19:30 +00:00
jenkins-bot f2bd9e84b4 Merge "Support reply tool on mobile" 2021-11-04 17:06:32 +00:00
Bartosz Dziewoński d0f8794388 Handle JS exceptions in API error logging
When an exception is thrown by our code elsewhere, and caught by the
promise mechanisms, it bubbles up here in the `code` variable, and
`data` is undefined.

Change-Id: I8a0ac49d22d254f353797fc8978871502ae8b9de
2021-11-03 22:21:18 +01:00
Ed Sanders 900a01772f Support reply tool on mobile
Bug: T270536
Change-Id: I94d04e9cd442f9a4e0c5924da67c43a768417a8b
2021-11-03 17:49:06 +00:00
jenkins-bot 10111ea872 Merge "Generate form tokens in the client to prevent double posting" 2021-10-29 22:32:47 +00:00
Ed Sanders 6022982eb9 Generate form tokens in the client to prevent double posting
Store used tokens in session storage.

Bug: T286409
Change-Id: I88c81689d9cf3447f6cc77c849a84d52c8b2c0db
2021-10-29 00:17:14 +01:00
jenkins-bot 9a8e33369b Merge "Allow more flexible overrides for the terms-of-use messages" 2021-10-28 15:05:16 +00:00
Ed Sanders f0149541b0 Update watchlist checkbox when main watchstar is changed
Bug: T294122
Change-Id: If50d5596fd86ed273658a275c9b3be31f39eaad7
2021-10-25 15:27:04 +01:00
Ed Sanders f4c12e120a Define documentable types in eslintrc instead of inline
These types can be passed a parameters to any file without
creating a dependency, so it makes more sense to allow
the globally.

Change-Id: I5504465fd997b46547642e7046993b370b85586e
2021-10-17 14:38:39 +01:00
Bartosz Dziewoński 11566e4b27 Allow more flexible overrides for the terms-of-use messages
Bug: T284097
Change-Id: Ibacd9397a40ffcc8a8127ec543cb2f7300ce5464
2021-10-05 17:58:37 +02:00
jenkins-bot 268b704b48 Merge "Add a link to preferences within the Reply and New Discussion Tools" 2021-09-28 16:34:59 +00:00
Bartosz Dziewoński 4be0751517 Fix almost all errors codes being logged as http-0
Follow-up to b52699ad35.

Bug: T290514
Change-Id: If82f10c58872d990b9dfa7cbdc9b784454a5fa46
2021-09-28 13:14:29 +02:00
Bartosz Dziewoński ca8781a3a0 Add a link to preferences within the Reply and New Discussion Tools
Bug: T291002
Change-Id: Id99f77d3a181aedd23305b7afa61a0a3fb6dabb7
2021-09-27 21:52:07 +00:00
Bartosz Dziewoński 3dbc5749ea Adjust use of 'plainlinks' class to fix button styling in some cases
It was previously applied on the whole wrapper of the anon
warning, including the buttons. In some cases (on mobile, and
on some sites with weird customized site CSS), this causes the
buttons to lose some styling. Apply it only on the label.
Follow-up to 522b7932d7.

Bug: T270536
Bug: T291000
Change-Id: Ia4bc99fc219a80efbf46a7cc196ea29720a34de8
2021-09-18 03:16:43 +00:00
Bartosz Dziewoński 9c20efcd4d Record timing for 'saveSuccess' and 'saveFailure' events
Bug: T290931
Change-Id: Id4ead2e0cc72174eec5f3849d8182d660905daea
2021-09-13 23:47:30 +00:00
Bartosz Dziewoński b52699ad35 Log more precise error codes for timeout etc. (and HTTP statuses)
Inspired by the code in mw.Api#getErrorMessage handling these cases.

Bug: T290514
Change-Id: I2eea17198dafaf9d3c4754cfb630de0ed7162daf
2021-09-09 23:46:44 +02: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 ea68e1a8f0 Introduce CommentDetails to group up and document stuff we pass around
Change-Id: I809524ea8d89130548964ba9e5a73f00f6089ff4
2021-06-21 22:12:18 +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
Ed Sanders 2b3345af11 Change feedback link for new topic tool
Bug: T279400
Change-Id: I5d72552f45a63199c0fbb516dc94aef19945c95e
2021-05-26 11:27:01 +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 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
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
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
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
jenkins-bot abb14d091a Merge "ReplyWidget: Hide external links icons in the anon warning" 2021-03-20 17:41:36 +00: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 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
Ed Sanders 5324e60e84 Tracking changes from VE source mode
Change-Id: I5cafa7a21a0ab90fab9d09e44b7525ee07f56709
2021-03-08 21:13:10 +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 01ac28540a Support the enable2017Wikitext option
Bug: T257391
Change-Id: If2511609035c26063203512f4b860bd0060e08af
2021-02-26 19:13:54 +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
Ed Sanders 33c6181e79 Rename indent replacement methods
Change-Id: I8cb1b58dad068be7cfa62cab9e932463a23c6b12
2021-02-17 23:42:57 +00:00
jenkins-bot 63a5916e53 Merge "Update warning about missing topic title immediately" 2021-02-02 12:11:21 +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
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 37b574f165 Separate dialog for abandoning a new topic
Bug: T269190
Change-Id: Ie4f486b0641edea369702631556d8ea31f991370
2021-01-19 21:40:21 +01: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 d76143bc08 Ability to add new discussion sections
1. Extend the JS modifier to allow adding top-level comments
   (that is, replies to headings). PHP modifier doesn't do this
   because we'll save the changes using paction=addtopic instead.

2. Subclass CommentController to allow adding a new heading and a
   top-level comment underneath it at the same time.

3. A lot of ugly code in ReplyWidget to customize the interface
   for this case. Much of it should probably be moved to
   CommentController/NewTopicController.

Bug: T267595
Change-Id: I9c707bb7f7aae1b92c72fb4dee436490f8c8409b
2021-01-12 20:15:28 +00:00
Ed Sanders a082535e02 Fix styling of error/captcha MessageWidgets
Change-Id: I592c1a08238dc46ee342672be29a8070b495f3dd
2020-12-11 16:27:07 +00:00
Ed Sanders 1871c70378 Show keyboard shortcuts in button tooltips
Bug: T264913
Change-Id: I3c5b248f7c7b0ef381baab84fe98d4ba0cefd35a
2020-11-26 19:06:17 +01:00