Commit graph

205 commits

Author SHA1 Message Date
Bartosz Dziewoński 549fcc062b Fix focussing the reply button/link after closing the reply widget
Change-Id: I0db0fc8a93512751f8a9bcc96b048c1ab1f24f95
2022-08-02 00:32:24 +02:00
Bartosz Dziewoński e7bbc9864c ReplyWidget: Scroll save error into view after showing it
Bug: T298263
Change-Id: Ibe488bf9184dc9d9c3c8b2c3491c0baf6676ba16
2022-07-25 18:16:13 +02:00
Ed Sanders 2c2e57fd47 Show a "Return to reply/new topic" button when widget is scrolled off the screen
Bug: T310967
Change-Id: I3d1626162eb5c66ac35560792a81ce09455e86a8
2022-07-18 13:20:12 +01:00
Bartosz Dziewoński 5c3277a196 Format number of comments in reply tool new comment warning
Bug: T312033
Change-Id: If8e95b9554eddec2f00c492885575266b02cc1af
2022-07-04 17:57:41 +02:00
Ed Sanders 639fabf647 Pass useskin/mobileformat when previewing/refreshing page contents
These are required to render content correctly on mobile.

Change-Id: I421e1f172e208c4bf9d50eee68f1b0220a78dfbe
2022-06-27 17:15:28 +01:00
jenkins-bot 521760ecdc Merge "Redesign "new comments" warning" 2022-05-12 17:21:23 +00:00
Ed Sanders cf3e7c49d8 Redesign "new comments" warning
Bug: T300560
Change-Id: I5abf22b5a11c2639392a3d571c987ed5afaac2d6
2022-05-12 18:02:32 +01:00
Bartosz Dziewoński d7c390a6ca ReplyWidget: Fix 'returntoquery' handling for anon links
mw.util.getUrl() already encodes the values, encodeURIComponent()
isn't needed.

Also, slice off the leading '?' – while MediaWiki seems to accept it,
it looks like it is never present in any other place using this
parameter (this is fine even if there are no query parameters).

Bug: T308198
Change-Id: Iee3747ab53e3b0a5a0b43a7701205ac0c7f07e7f
2022-05-12 03:23:29 +02: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
Ed Sanders 487be9e202 Show error message as soon as we detect the parent comment has been deleted
Bug: T300504
Change-Id: I654422f7931f50503e51500508aea728adf327a1
2022-03-04 00:40:29 +00:00
Ed Sanders da49448f43 Poll for new comments in the section you are replying in
Bug: T300504
Change-Id: I3a887ab2f5260bb4893a3d680103c9d8ec767f45
2022-03-04 00:40:29 +00:00
Bartosz Dziewoński 1d43a024f9 Handle reply/topic preview entirely server-side
We were rendering the preview in a completely different way from how
we would add the real reply, and the results would be different
sometimes, particularly for multi-line comments with messed-up markup.

Render it server-side instead, in a very similar way to real replies
(generating a DOM list node and transforming it through Parsoid),
although without the whole context of the page to improve performance.

We can remove a lot of client-side code that was used solely for this.

This will allow the preview to accurately display the signatures when
we change how they are added (T278442), without us having to implement
those changes again from scratch for the preview.

Change-Id: I53341f4d4075c25b67ec3b3032bff9b8a880dcd3
2022-02-21 17:42:28 +01:00
Ed Sanders 3d0849112a ReplyWidget: Factor out #createErrorMessage
Change-Id: Ie7e34154d74c24ce8379552fdf13feba31fd401f
2022-02-07 22:44:09 +00:00
Ed Sanders e2f3c2f264 ReplyWidget: Introduce a 'refresh' teardown mode that preserves auto-save
Change-Id: Ibb04f7c2813b9d3cf2bb2434a414c86eb0a7f644
2022-02-02 18:38:22 +00:00
Ed Sanders dd9d37b555 Create MemoryStorage wrapper around mw.SafeStorage
This means we can guarantee we will be able to recover
auto-saves if we don't reload the page.

Change-Id: Ic867ae6df0c949f35cb32ec4b835688778db29ef
2022-02-02 14:59:47 +00:00
Ed Sanders 7381d9d963 Cleanup CommentController and document
* Document all methods
* Rename comment to threadItem
* Use this.threadItem instead of passing in identical
  threadItem in various methods.
* Don't pass threadItem to ReplyWidget as we already
  pass the whole CommentController.

Change-Id: If9aad0bcf9f0e4ebf3342b75631ddac8b57f7d87
2022-02-02 00:05:19 +01:00
jenkins-bot 7f329ca9a2 Merge "Enable wikis to customize the syntax used for replies" 2022-01-12 21:32:49 +00:00
Bartosz Dziewoński 7b1053300a Enable wikis to customize the syntax used for replies
The following values for configuration variables are supported:
$wgDiscussionToolsReplyIndentation = 'invisible'; (default)
$wgDiscussionToolsReplyIndentation = 'bullet';

Bug: T259864
Change-Id: Icefad79630adc6ed35687498614e6a03ede1451b
2022-01-12 20:54:04 +00:00
Bartosz Dziewoński 08d33f4ced Ignore the watch star when replying to a transcluded comment
Bug: T298917
Change-Id: I2523f5cf53151c4c32699ce0b0cadbcb7f9bd02d
2022-01-10 23:30:09 +01:00
jenkins-bot a627011ddf Merge "Use new wikipage.watchlistChange hook" 2022-01-10 22:21:17 +00:00
jenkins-bot ef13ceb9aa Merge "Fix some typos in doc comments" 2022-01-10 16:50:14 +00:00
Ed Sanders 238a6b49b4 Use new wikipage.watchlistChange hook
Bug: T294254
Depends-On: I88af8585e8fc75f77ebef867d267199aeb2c6592
Change-Id: Ic7201de567329b5752dcf52602602030d7c347f0
2021-12-21 13:00:48 +00:00
Ed Sanders 8c6fadeb65 Remove getHeading from HeadingItem (JS)
This matches the PHP implementation and was only used in
one place (when fetching authors in new topic tool).

Change-Id: I9d9e774616112e8dc6ab4919846e3abecc24553d
2021-12-21 01:33:50 +00:00
Bartosz Dziewoński 95780b0fab Fix some typos in doc comments
Change-Id: I0f6c78e49e4eb30549f313d1a48f28a648cbd3f3
2021-12-20 22:24:03 +01:00
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