Commit graph

185 commits

Author SHA1 Message Date
Ed Sanders 44fd8ec0ef Parser: Return mw.Title from getTitleFromUrl
Change-Id: I2c3ce50c5ff7486d6c1f3a0c26cb3a9f1c252b60
2020-05-05 21:34:46 +00:00
David Lynch b7ad053105 @Username completion in VE (source or visual) mode
Bug: T232601
Depends-On: I075cac9aa195574c3d416a40bbdc5ec2d64424e2
Change-Id: Ie605e783b333be0f81099d8d953725c38eb4cee1
2020-05-05 09:44:08 -05:00
Ed Sanders 5da26e2d0b parser: Have getAuthors return a list
Change-Id: Ieda881a26f802a9e8c73822fcbcc70dd6035bbb6
2020-05-05 12:13:12 +01:00
Ed Sanders 5271b3eafd Move CommentController to separate file
Change-Id: I6dbf16801058e7e41d38a0ce5753c298d380b780
2020-04-30 17:05:04 +01:00
Ed Sanders 2aa6e5f583 Allow inspectors to position beyond the surface
Change-Id: I3cd0e433ea117b1b469e5a2111f4c7988c48abfd
2020-04-30 17:05:02 +01:00
Ed Sanders a5ed469843 Create CommentController class and move most Controller methods to it
This means we have an instance for each comment, which makes keeping
track of local variables much simpler, and will make switching out
the widgets easier.

Change-Id: I7584870225b1a14146852987d6a40ad05957387c
2020-04-29 22:21:32 +02:00
Ed Sanders 75da1e0b3a ReplyWidgetVisual: Use hasContent instead of hasBeenModified for isEmpty
Change-Id: I093a4b68573809e5222db01aead3ce00ed9a87ae
2020-04-29 16:32:00 +01:00
jenkins-bot 922443f68f Merge "ConfirmEdit CAPTCHA support" 2020-04-29 12:04:44 +00:00
jenkins-bot e624e17471 Merge "Remove client-side timeout when saving pages" 2020-04-28 22:38:27 +00:00
jenkins-bot bb096d8f50 Merge "Revise error messages when replying to comments affected by templates" 2020-04-28 22:35:47 +00:00
jenkins-bot 431716577b Merge "Add 'cursor: pointer' to the reply link" 2020-04-28 22:33:34 +00:00
jenkins-bot ba3fd84243 Merge "Minimum keyboard-accessibility for the reply link" 2020-04-28 22:33:33 +00:00
jenkins-bot 5fdf6ae466 Merge "Fix inserting replies inside a <pre>" 2020-04-28 22:31:45 +00:00
Bartosz Dziewoński 021c981817 Add utils.getNativeRange() method
Change-Id: Iab6c5fa092560ee9dff808bbcc405722914febe7
2020-04-28 23:11:26 +02:00
Ed Sanders 04f8e21554 Implement auto-save for ReplyWidgetPlain
Bug: T240257
Change-Id: Ica51fb51a5091b11aceb3cd5c484ef9c71b98af2
2020-04-28 20:32:20 +02:00
Bartosz Dziewoński 047e8eb82c Fix inserting replies inside a <pre>
In the future, we should think about a better solution that also
handles other elements (T250126), but this is an easy fix for now.

Bug: T250512
Change-Id: I1321f0da523ddb4a999b8c453b9094a267b38ae2
2020-04-27 23:23:31 +02:00
jenkins-bot f376230459 Merge "Move VE toolbar to top right" 2020-04-27 21:17:01 +00:00
Bartosz Dziewoński c07243c88f Add 'cursor: pointer' to the reply link
Bug: T250337
Change-Id: I77949f59ac4da27e7a25b5c35ca2a9df66f22872
2020-04-27 18:30:07 +00:00
Bartosz Dziewoński 7cb7722b76 Minimum keyboard-accessibility for the reply link
Using an approach similar to that in jquery.makeCollapsible.

Bug: T249915
Change-Id: Ia3dc43d23c29cd936a9445766e394f96f096da75
2020-04-27 18:30:00 +00:00
Bartosz Dziewoński 4ad9aa8449 parser: Don't crash on links to invalid titles
Bug: T251045
Change-Id: I1a7b8b9b34d38ec4e3edc12687bdf99bb0e61bd8
2020-04-27 19:59:26 +02:00
Ed Sanders cd7acc741b Move VE toolbar to top right
Change-Id: I97b322ded505df608eda73a7c6a04157e993d73b
2020-04-27 16:42:35 +01:00
Bartosz Dziewoński b1376413f0 Revise error messages when replying to comments affected by templates
Bug: T248607
Change-Id: Iea49d16bb0e5c71b36a79248f3f91f7987e65702
2020-04-26 19:50:32 +02:00
Bartosz Dziewoński 7ef3bffb1e Show error on pages with fostered content to avoid page corruption in Parsoid
When the user clicks a "Reply" link on a page that is affected by the
'fostered' lint error (indicating fostered content in the HTML
representation), display an error and refuse to edit it, as Parsoid's
transformations will damage the page content.

The error message includes a link to documentation about lint errors,
and a link to the editor that will highlight the error location.

Depends-On: I723ec766d1244d117f8d624440026fe5af0d3403
Bug: T246481
Change-Id: Ic60cb58f98d10dc9b113469e5d3bbfb2d2b0564f
2020-04-21 17:40:39 +00:00
Bartosz Dziewoński 40c18508ec ConfirmEdit CAPTCHA support
Depends-On: I6605017fd31a4f96c529dd0beb69e9f4433cebc1
Bug: T247513
Change-Id: If9b3162969aa6ee67baff80aa84fa719bd3c3720
2020-04-21 18:55:38 +02:00
Ed Sanders d3c46a2967 eslint: Disable max-len
Change-Id: I7e49dc170dba62b88f1879ae670f806f6b54d4e9
2020-04-21 15:50:19 +01:00
Bartosz Dziewoński e3e36e11ac Remove client-side timeout when saving pages
Bug: T249071
Change-Id: I367c5931c05cf944bfad0f9fff69f06b32880411
2020-04-20 23:29:10 +02:00
Ed Sanders 0f7eb2e36a Add "watch this page" checkbox
Bug: T245222
Depends-On: I1e0e9bb9da53a62f8a20126e579dcd6300bd2376
Change-Id: If966d2fa97648452a50a2318988a8b64d7c449cd
2020-04-20 12:40:44 +01:00
Ed Sanders ba89657994 Add a share feedback link
Bug: T249016
Change-Id: I64abeebeea332a7a4a37fd4bfd6d5f9a5defc8b5
2020-04-14 23:04:18 +00:00
Ed Sanders d40e427b5b Remove extra linebreaks from wikitext
Extra lines currently render empty list items which are invisible.
Remove these as the user probably didn't intend from them to appear
in the wikiext.

Bug: T249867
Change-Id: I75c1192a94b918783d362d38cd91a508bb169d56
2020-04-14 20:29:38 +00:00
Ed Sanders f04abd02d4 Improve autosign handling of 3/5 tilde sigs and add tests
3 or 5 tilde signatures will be assumed to be erroneous and fixed
to 4 tilde signatures. This will be visible in the preview so shouldn't
come as a suprise to users.

Bug: T245628
Change-Id: I741f0761a6fb10c99cf3239ac5c6c7e1a2b872c7
2020-04-14 20:29:31 +00:00
Ed Sanders 5597787eb4 ReplyWidget: Replace .mode with #getMode
.mode was only set the end of the constructor.

Change-Id: I1a14167d1b2e524742da31f78c6cbfaf96aec667
2020-04-14 19:42:29 +00:00
David Lynch e38aad96e4 Add override config for instrumentation rates
Bug: T250086
Change-Id: I32fbf3d6562fb0a93698a24bbd8177149a19fed3
2020-04-13 12:38:40 -05:00
Bartosz Dziewoński 55b43a70d4 Fix skipping to the end of the paragraph when there is no wrapper
Bug: T249217
Change-Id: I77847901d98f56dbcbcf379c6c17f41e06a3a939
2020-04-03 18:11:59 +00:00
Bartosz Dziewoński a14293c8e7 Remove Parsoid section wrappers before finding transclusions
The section wrappers can be marked as template-affected when the
previous or next section is transcluded, causing comments to be
unnecessarily uneditable. The new test case demonstrates this.

Depends-On: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
Change-Id: I895a04990d79a3475d778b4fef054ea0bb076f0b
2020-03-24 23:31:21 +01:00
Bartosz Dziewoński 807afd1ec0 Save the reply directly to the transcluded page
* When we discover the comment comes from a transcluded page, follow
  the transclusion to find the source page. We follow transclusions
  recursively, up to an arbitrary limit of 10.
* In the reply widget, display the title of the page where we will
  save the reply, to avoid users confused why their edit won't show up
  in the history. In the wikitext workflow this is done by redirecting
  the user to the edited page at the end, but it seems less surprising
  to stay on the current page.
* After saving the reply, we must purge the current page, otherwise
  the new content will not be immediately visible on it.

Bug: T247535
Change-Id: I1c6631aa65a2fce6c1c2f0dd4a8c7aa6389caf94
2020-03-24 22:29:42 +00:00
Bartosz Dziewoński dab37fd7b4 parser: Make #getTranscludedFrom return page title in text form
It's more convenient for display or comparing it with other things.

Depends-On: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
Change-Id: I88d7aa68977210b16860075ed52983a5e99ee0f7
2020-03-24 22:29:35 +00:00
jenkins-bot 85472b7e31 Merge "ReplyWidget: Double-check that we can post before posting" 2020-03-20 19:37:48 +00:00
jenkins-bot 5b8b801989 Merge "Use 'baserevid' instead of 'basetimestamp' for edit conflict detection" 2020-03-20 19:30:15 +00:00
Bartosz Dziewoński 7fcd880fa5 controller: Fix minor issues with error popup
The rejection handling callback was accidentally resolving the
promise, which resulted in an error like 'TypeError: Cannot read
property '$element' of undefined' when the resolution value was
used.

Fixing this reveals that we weren't removing the placeholder list
element correctly. This wasn't immediately visible because of the
.empty() call in the next resolution callback, but it would have
caused something similar to T245574.

Follow-up to 6964f0c965.

Change-Id: I3aeb9a86046c4ccaa6c39301edc7285d02b0320c
2020-03-20 19:01:03 +00:00
Bartosz Dziewoński 9d2cb7bdd0 Also update 'jsconfigvars' when previewing
This fixes a warning in the API: 'Property "modules" was set but not
"jsconfigvars" or "encodedjsconfigvars". Configuration variables are
necessary for proper module usage.'

We were already updating them when saving.

Change-Id: I3e16e3fd4b43a438c27645cca90517b6b4be7db7
2020-03-19 18:19:15 +01:00
Bartosz Dziewoński a6ce1e23a7 ReplyWidget: Double-check that we can post before posting
Bug: T246058
Change-Id: Ic87b062c2fd6d7f48933a94e140ce392003ee65a
2020-03-19 01:03:09 +01:00
Bartosz Dziewoński e9b583d1c3 parser: Improve merging multiple comments on one line
Now also works if the "follow-up" comment is wrapped in e.g. `<small>`.

Change-Id: Ic37cb6afdb42021f109a1818f5c4299d907ed094
2020-03-14 13:34:42 +00:00
Bartosz Dziewoński 04365c0188 Merge RL modules which are only loaded by 'ext.discussionTools.init'
Bug: T240474
Change-Id: I1b83aa18666be8f1ea6a3602b299f92574d42cb7
2020-03-14 14:33:23 +01:00
Bartosz Dziewoński 92c3f079b8 controller: Make edit summary use the wiki's content language
Bug: T246043
Change-Id: I591e1a3ed3e7c8b68f5e203a0c77d057793fc767
2020-03-14 14:17:29 +01:00
jenkins-bot f97e6303a3 Merge "controller: Show error messages immediately when loading fails" 2020-03-13 22:13:19 +00:00
Ed Sanders 1be47f0599 Support saving multi-line comments in VE
Change-Id: I3e19fac750dbb8d10b6e1bf6081453c75768e625
2020-03-13 16:12:01 +00:00
Bartosz Dziewoński 6964f0c965 controller: Show error messages immediately when loading fails
Previously you'd only learn about the issue when saving failed.
Now a modal alert dialog with the error message appears.

This means that we have to wait for the loading to finish before we
can display the ReplyWidget now... this should not be noticeable,
since we preload in #init.

Bug: T247533
Change-Id: I5468e67c449d530a0d15f69bff954d37a5b6a14c
2020-03-12 19:24:00 +01:00
Bartosz Dziewoński 4e135c7f07 Use 'baserevid' instead of 'basetimestamp' for edit conflict detection
This has two benefits:
* Allows detecting a conflict if two edits are saved in the same second
* Doesn't ignore conflicts with yourself (T246726)

Depends-On: Id7565018f66860b5c2ba688777508db1b88700ae
Bug: T246726
Change-Id: I22eaa1af5692854870d31e08b171a070a2fda0de
2020-03-12 16:31:32 +00:00
Bartosz Dziewoński 574d519f92 ReplyWidget: Fix spacing for save error messages
This was accidentally removed in c8564f6ccb.

Change-Id: Ie08ad6f8e34abedec437e418dea492cce35d74ca
2020-03-11 22:01:44 +01:00
Ed Sanders 2fcd975764 Fix padding in visual mode
Change-Id: I43229baedf73ea9273b8796792de909b7bcbd462
2020-03-11 15:03:44 +00:00