Commit graph

661 commits

Author SHA1 Message Date
jenkins-bot 76da6af031 Merge "Move some setup code from CommentController to controller.js" 2021-01-26 17:02:22 +00:00
Bartosz Dziewoński c781b127c9 Handle category links at ends of comments affecting indentation
* Ignore rendering-transparent nodes between discussion comments.
* Improve isRenderingTransparentNode() so that <link> nodes
  representing TemplateStyles are not considered transparent,
  otherwise this would undo ae920b831f.
  Using a regexp from Parsoid.

Bug: T272746
Change-Id: I0b3c3251156ba6c4826abf5ba44ea93f80ebc01d
2021-01-26 04:55:03 +01:00
Bartosz Dziewoński 344038ae41 Don't show error message popups when failing to restore auto-save
Several of the messages talk about clicking the reply links, which
seems unhelpful. Also, showing a fullscreen popup on page load seems
very unhelpful too. (Itoldyouso that we shouldn't use popups.)

Bug: T268069
Change-Id: Id1312cf06200fb45a28b39481a99cc2c96603fa4
2021-01-26 03:03:19 +00: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 718457130e Move some setup code from CommentController to controller.js
We'd like the [reply] links to behave differently if other
CommentControllers are already active, but each CommentController
doesn't know anything about others; only the main controller.js does.

Change-Id: Ic21b2d40d213a325509822f703709f52aa8dc8d7
2021-01-25 23:33:58 +01:00
Bartosz Dziewoński 60272fc348 Fix cookie loading hack
If the module is loaded on a page where DiscussionTools is
not supposed to be enabled, wgDiscussionToolsFeaturesEnabled
will be undefined, and the code will crash before it can set
the cookie that enables it for future page views.

Bug: T272850
Change-Id: Ia1c40cfc3cbee62823f1806bd20229883905677a
2021-01-25 15:17:20 +01:00
jenkins-bot 7bf858066f Merge "NewTopicController: Clear section title on teardown" 2021-01-20 00:31:07 +00:00
jenkins-bot e0fafcee3d Merge "CommentController: Better handle clicking links while already commenting" 2021-01-20 00:28:11 +00:00
Bartosz Dziewoński 2337600f38 NewTopicController: Clear section title on teardown
Bug: T272393
Change-Id: I633adc17c18e50b921400ec2fcab57649da147dc
2021-01-20 00:23:10 +00:00
jenkins-bot 1c9f038aac Merge "Padding and border around new topic tool" 2021-01-20 00:04:31 +00:00
jenkins-bot 8d999c5ebf Merge "Separate dialog for abandoning a new topic" 2021-01-20 00:04:29 +00: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 2798ee73f4 CommentController: Better handle clicking links while already commenting
Bug: T272389
Change-Id: If28a6cce250dca4810de3f51c0a2a4587d00649e
2021-01-19 21:21:47 +01:00
Bartosz Dziewoński 9ee2341310 Fix skipping past our own reply buttons for wrapped comments
Bug: T272318
Change-Id: I7c80a0be3af76d4db19f9934c5869be07e4bc52c
2021-01-18 20:42:23 +01:00
jenkins-bot e17467b09c Merge "Fix exception when trying to use non-existent 'typeof' attribute" 2021-01-18 18:58:35 +00:00
Bartosz Dziewoński 8f42c74985 Fix skipping to the end of paragraph, now it considers nested tags
Add yet another tree walking utility: CommentUtils::linearWalk().
Unlike TreeWalker, it allows handling the beginnings and ends of nodes
separately – kind of like parsing a XML token stream, or kind of like
VisualEditor's linear model.

(Add unit tests for this utility. The simple.html test case is copied
from [VisualEditor/VisualEditor]/demos/ve/pages/simple.html.)

Use this utility to stop skipping when we reach either a closing or
opening block node tag. Previously we'd skip over such tags inside
nested "transparent" nodes (like <a>, <del>, or apparently <font>).

Bug: T271385
Change-Id: I201a942eb3a56335e84d94e150ec2c33f8b4f4e0
2021-01-18 18:20:20 +00: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 c20e7765ea Fix exception when trying to use non-existent 'typeof' attribute
Bug: T272090
Change-Id: I4d1e7457441f28d789dec8b7fd2dc3ba10fd995e
2021-01-14 22:11:32 +01:00
Ed Sanders c42e86f0f6 Config: Explicitly check feature availability in the client
Don't assume a feature is available because the code has
loaded and the user option is set. Export the logic from
Hooks.php to the client.

Change-Id: Ica0e58de7ed0d59e3b09645193eb2b691ae41c39
2021-01-14 19:04:18 +00:00
Ed Sanders e16a519a05 Padding and border around new topic tool
Bug: T269157
Change-Id: I4f56f9dc0eca71ea4ed452df49e861aac47e3de8
2021-01-13 20:54:59 +00:00
David Lynch 27a995d5a2 A/B test bucketing for beta enrollment
If DiscussionToolsABTest is enabled (set to `all` or a feature), logged
in users who have never used the tool before will be assigned to an a/b
test bucket. If they're in the test bucket, they get the feature
enabled.

If they manually set their beta feature preference, we don't override
that but do maintain their bucket for logging purposes.

Bug: T268191
Change-Id: I9c4d60e9f9aaef11afa7f8661b9c49130dde3ffa
2021-01-13 10:32:00 -06:00
jenkins-bot dce452fe6b Merge "Give new-section a specific init_type to distinguish it" 2021-01-12 22:02:13 +00:00
Ed Sanders 706f4438fc Add "new topic" user preference
Bug: T270119
Change-Id: Ie27ea645602f7533610826cbc0cc422e3682d863
2021-01-12 20:15:46 +00:00
David Lynch 5696495754 Give new-section a specific init_type to distinguish it
Bug: T265099
Change-Id: I0117a41ec44263162621a34cf045b13650c6918c
2021-01-12 20:15:41 +00: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
jenkins-bot 446d4dc3ec Merge "ReplyWidget: Ensure scrollbar doesn't appear in source mode (for real)" 2021-01-08 23:17:01 +00:00
Ed Sanders 823d61a69c Use content direction for styling reply links
Change-Id: Ib14ff4b69a20a2e928925a790a8892b6b2e29794
2021-01-08 17:08:45 +00:00
jenkins-bot 4673cae615 Merge "Move the '@' prefix into the PingNode, rather than plain text" 2021-01-04 21:56:26 +00:00
jenkins-bot 8a6bb8efd0 Merge "Ignore outdent templates at the beginning of comments" 2021-01-04 21:48:27 +00:00
jenkins-bot fa9d729728 Merge "Change which nodes are ignored at the beginning of comments again" 2021-01-04 21:47:40 +00:00
Bartosz Dziewoński bca14cbe03 Move the '@' prefix into the PingNode, rather than plain text
Depends-On: I49733aa6aa2c1e61a88e7c88e84f1f4338acfac1
Change-Id: I9586d07ded0e41afdcfbd6e46364bb1f837cf1c0
2021-01-04 21:43:42 +00:00
jenkins-bot f4106e8dc7 Merge "Fix detecting decorative comment frames with whitespace" 2021-01-04 21:41:30 +00:00
Bartosz Dziewoński 6e37a172ae Fix detecting decorative comment frames with whitespace
As a result of 0fc71f60cd, "empty" text
nodes (containing only whitespace) at the end of the comment may be
inside the comment's range, and trying to ignore them caused the
ranges not to match and the frame not to be detected.

Now the code works whether they're inside the comment's range or not.

Add a test case for wrapped discussion comments with HTML comments and
with whitespace.

Bug: T250126
Bug: T268407
Change-Id: I2217ff5a635fd1c9c9e803f46795b1bfb3d17535
2021-01-04 20:31:33 +01:00
Bartosz Dziewoński f44806c0c8 ReplyWidget: Ensure scrollbar doesn't appear in source mode (for real)
Follow-up to d5a1b7bc2b.

The rule hiding the scrollbar was applied to the wrong element.

Bug: T267609
Change-Id: I596f29ba191032a82c579c63e9aa526eb4e887aa
2021-01-03 17:22:13 +01:00
Ed Sanders fb6146053a Convert highlighter.css to less
Change-Id: I41f6d9536a589b6423f4fc619d5058335083a570
2020-12-23 16:50:32 +00:00
Ed Sanders cb4a833cd2 Stylelint: Enforce class prefixes
Change-Id: Id3f13f73f63883277044cd24c9e27874c688577f
2020-12-23 16:47:55 +00:00
Ed Sanders b8be2e352d Follow-up I6f6a869: Apply flex wrapping of actions in anon mode as well
Bug: T259320
Change-Id: I6e0a275d4b45f1ce8661729313a159060c259ae1
2020-12-17 22:24:18 +00:00
Ed Sanders bdca6fb54f Add explicit dependency on targetLoader
Comment stated that it is loaded in getPageData but
that is no longer true.

Change-Id: Ideb2129ae605135c3de0362ce0d33aa03a9b6d87
2020-12-15 19:34:57 +00:00
jenkins-bot fa5b595ec0 Merge "Restore correct height of "Advanced" button" 2020-12-15 16:33:57 +00:00
Bartosz Dziewoński 95f8a4a8db Restore correct height of "Advanced" button
Looks like something changed in OOUI?

Change-Id: I383329a36212b1ab66eb563175ad14fa1965b7e4
2020-12-15 15:55:59 +01:00
jenkins-bot ee9e3dcbdc Merge "Fix highlight rendering in Safari with GPU hack" 2020-12-15 00:17:56 +00:00
Ed Sanders 236c46d256 Fix highlight rendering in Safari with GPU hack
Change-Id: Ib44aba55c568d0fc9fa8761b09abecd5b55b8897
2020-12-14 22:56:08 +00:00
Bartosz Dziewoński 5867699bf8 Remove a fixed TODO comment
The problem was fixed in 15cb419f56,
then the comment restored in 633cc9a7b3
(looks like a rebase mistake).

Change-Id: Ic31ea0bf88480cff02f40701f1317f35c1c6e891
2020-12-14 22:16:16 +01:00
Bartosz Dziewoński 50ad5bb2b4 Ignore outdent templates at the beginning of comments
Bug: T264116
Change-Id: Iae9dbb30a1aead897cc274f655d3ecff4b297dbd
2020-12-14 21:35:56 +01:00
Bartosz Dziewoński ae920b831f Change which nodes are ignored at the beginning of comments again
While working on T270009, I noticed that <style> and <link> nodes
are treated differently, which seemed weird. Rewrite this again,
hopefully this is the last time.

The changed test cases also involve <area> and <input> nodes,
and the new results make more sense to me.

Bug: T264116
Change-Id: I3af90c84768a4b3dc53446927f4dba6f72175a2f
2020-12-14 21:33:50 +01:00
jenkins-bot b491d52c03 Merge "Debug: Introduce "vote" debug mode" 2020-12-14 17:39:50 +00:00
jenkins-bot 5f2684a8d0 Merge "Debug: Fix signature range higlighting" 2020-12-14 01:55:18 +00:00
Ed Sanders 633cc9a7b3 Debug: Introduce "vote" debug mode
Bug: T269163
Change-Id: Ie8da7acf3660a6d30b92d7803d87ad51a3275369
2020-12-12 13:21:48 +00:00
Ed Sanders 43443971a0 ThreadItem.js: Fix documentation comment
Change-Id: I2b0207eb5f3689845daf5e6dd293a59d2ec890b2
2020-12-12 12:58:16 +00:00
Ed Sanders 15cb419f56 Debug: Fix signature range higlighting
Change-Id: Ieb5af739bb98761d8473edb87f1eb752dc386ea1
2020-12-12 12:56:54 +00:00
Ed Sanders a082535e02 Fix styling of error/captcha MessageWidgets
Change-Id: I592c1a08238dc46ee342672be29a8070b495f3dd
2020-12-11 16:27:07 +00:00
Ed Sanders fb0cc01ff8 Skip over empty inline templates (e.g. tracking templates)
Bug: T269036
Change-Id: I15e56041c1f1ecb85e9e368a9fbb07882438bf8d
2020-12-09 18:51:41 +00:00
Bartosz Dziewoński 8c9230fa10 Handle category links like comments (rendering-transparent nodes)
Bug: T269036
Change-Id: Id4321ad09907b5030881456c93da90a39bdfdd75
2020-12-08 21:39:16 +00:00
Bartosz Dziewoński 113ad01d5e Consistent use of isBlockElement() in JS code
(Consistent compared to our PHP code)

Change-Id: I4aba6f22cc7da2da30ccd6346e4390b14bd347af
2020-12-05 22:48:34 +01:00
jenkins-bot 54f13b11a0 Merge "Tweak colors and timing of the highlight on posted comments" 2020-12-05 01:49:53 +00:00
Ed Sanders b71376a183 Trim signatures when added on a new line
Bug: T269188
Change-Id: I48d394020b8780ff93d97747d45009c37c071b53
2020-12-02 20:18:42 +00:00
Bartosz Dziewoński b92ae47e00 Tweak colors and timing of the highlight on posted comments
* Use a slightly different color
* Use 'mix-blend-mode: multiply' when available to avoid fading
  the text color
* Add fade-in animation and make fade-out animation slower

Bug: T268994
Change-Id: I210ed4fd55c3dc184d13daf915fa93bee3699ad5
2020-12-01 23:44:39 +01:00
Bartosz Dziewoński 7c01e20e47 Add postEdit notification
Per T267595#6656121

Bug: T268994
Change-Id: I2c47fc36ff6515b1f5f5e6bfd11f41eec9c1cd86
2020-12-01 21:43:39 +00:00
jenkins-bot d52f6334ea Merge "Show keyboard shortcuts in button tooltips" 2020-11-26 18:12:03 +00:00
jenkins-bot 019307660e Merge "Don't include the logged in user in local suggestions" 2020-11-26 18:08:46 +00:00
Ed Sanders 1871c70378 Show keyboard shortcuts in button tooltips
Bug: T264913
Change-Id: I3c5b248f7c7b0ef381baab84fe98d4ba0cefd35a
2020-11-26 19:06:17 +01:00
Bartosz Dziewoński 0fc71f60cd Skip to the end of the paragraph if it's just text, too
We've recently decided that we want to "extend" comments until
the end of the paragraph (e36dc8e78a,
d0ae6c4e44).

However, we still had this special case that did the opposite: it
ensured that if a comment ended in the middle of a text node, the
comment would not be extended to the end of the node. Remove it.

Note the change in the test file signatures-funny-formattedreply.html,
which actually covered this case specifically.

Change-Id: Id1384bb0c6e1a5f0c70f55efcb4caa240f230f07
2020-11-25 00:48:53 +01:00
jenkins-bot aa0e89e3cf Merge "Skip end marker "forward" until a block tag is reached" 2020-11-23 17:00:34 +00:00
jenkins-bot c87f6ef031 Merge "De-indent multi line comments when fetching comment bodies" 2020-11-23 16:20:54 +00:00
Ed Sanders d0ae6c4e44 Skip end marker "forward" until a block tag is reached
The end marker is skipped forward until an open or close
block tag is reached. In tree traversal terms this means
moving either to the next sibling, or the parent (to skip
over close tags).

Bug: T256033
Change-Id: Iaa2c588698790d576ac4f9ecc126f58a082ef6b3
2020-11-23 15:08:29 +00:00
jenkins-bot 7467e89da4 Merge "Fix displaying reply links after posting a reply with dtenable=1" 2020-11-22 23:02:21 +00:00
jenkins-bot 4eed14b4e7 Merge "Fix client-side IDs for indistinguishable comments" 2020-11-22 22:38:57 +00:00
Ed Sanders 15696f141c De-indent multi line comments when fetching comment bodies
Change-Id: Iaacd227ce2185f4fe2b29463a33b038de7aadb7e
2020-11-22 21:49:08 +00:00
jenkins-bot cac72e1c99 Merge "Fix start node for comments following headings" 2020-11-20 18:22:34 +00:00
Ed Sanders 44a1bbcc59 Fix start node for comments following headings
The general rule is that comments start after their preceding
thread item, but when that is a heading we should skip past
the entire <h[1-6]> node to avoid making section edit links
part of the first comment.

Bug: T267988
Change-Id: Ia7f1b27e0a69a9aab7c7da743bf8549479304096
2020-11-19 23:48:30 +00:00
Bartosz Dziewoński d0b6904bae Fix client-side IDs for indistinguishable comments
Bug: T268093
Change-Id: I198b090904e3ae5f2e214b457233d61cb77802af
2020-11-18 20:08:21 +01:00
Bartosz Dziewoński c17a076382 Fix displaying reply links after posting a reply with dtenable=1
Bug: T267847
Change-Id: Ifb59cb942b673d9abcab563e6bc27fa1f6d5e9d7
2020-11-18 19:29:04 +01:00
Ed Sanders e2f93727d4 Improve highlighter styling
Change-Id: Ie2982d1f8da217cad2fe7080137c39900451c591
2020-11-16 23:34:26 +00:00
Ed Sanders 2328a3cad0 Group comment warnings in DOM so they don't break alternate colours
Change-Id: I0516a57a30a59ee6eac0ad2f23f05ad83c396391
2020-11-16 23:32:56 +00:00
Ed Sanders 4d0498853d Highlighter: Fix check for comment warnings
This was causing the highlighter to not alternate colours.

Change-Id: I9bb95e02ae91967c696f026198efb27d4d8414d4
2020-11-16 23:18:05 +00:00
Ed Sanders a87d60228f Don't include the logged in user in local suggestions
Bug: T267680
Change-Id: I1b2d185de390b73e1b389fc4139735069e7a65dc
2020-11-16 22:48:21 +00:00
Bartosz Dziewoński d5a1b7bc2b ReplyWidget: Ensure scrollbar doesn't appear in source mode
Even though the field is supposed to resize itself to match the text
inside, vertical scrollbar would sometimes appear when the user has
zoomed in. Some calculation probably handles fractions of pixels
incorrectly (might be a bug in OOUI or a browser bug).

Since this field has no limit on max rows, we can just hide the
scrollbar. This can't be fixed in OOUI itself, since its autosize text
fields usually have a limit to how tall they are allowed to grow
before a scrollbar is used.

Bug: T267609
Change-Id: Id36ed417c4678e469a6c05715404e330064c2017
2020-11-10 12:20:30 +01:00
jenkins-bot 579cc20120 Merge "Move ID->title logic into HeadingItem" 2020-11-05 18:10:08 +00:00
jenkins-bot e378a9122b Merge "Don't detect comments within headings" 2020-11-05 16:56:02 +00:00
Ed Sanders 3c88f7de39 Always use ':' for indentation in preview
Matches what we end up posting. Leave context-aware code
commented out as this issue is not settled yet.

Change-Id: I7360e53d5d7823b2b52318005459212a21a6edc2
2020-11-05 16:15:38 +00:00
Ed Sanders 79c91c3cfc Move ID->title logic into HeadingItem
Change-Id: I03408d2404a99b5bc7795c1c4bf214d4b5fea1e0
2020-11-05 16:10:39 +00:00
Bartosz Dziewoński 203a4dcb42 Use 'id' attributes rather than heading text for edit autosummaries
Ideally the edit autosummary would be generated in the same
way as in the old wikitext editor: from the wikitext of the
heading. But on the JS side, we don't have access to the
wikitext, or to the PHP method that generates autosummaries.

This might seem crazy at first, but ultimately the point of
the autosummaries is to link to the section heading by its
'id' attribute, so it is perfectly reliable.

Doing it this way depends on $wgFragmentMode being set to
[ 'html5', 'legacy' ] or [ 'html5' ], otherwise the escaped IDs
are super garbled (particularly in non-Latin-alphabet languages)
and can't be unescaped reliably. Conveniently, we already
require that since 9ee0fd69f5.

Bug: T264561
Bug: T266725
Change-Id: I7d35098d672d0edb50d49e22de1686d5cc83b60e
2020-11-05 15:13:08 +00:00
Bartosz Dziewoński bed717d329 Move getHeadlineNodeAndOffset() to utils
Needed by I7d35098d672d0edb50d49e22de1686d5cc83b60e.

Change-Id: I44bf927213de570fe9de43e485e09cfae6778eef
2020-11-05 16:11:30 +01:00
Ed Sanders 7abd4621ae Use new heading markers for getting heading ranges/text
This will need to be deployed a few days after I782caafc3
to avoid issues with cached HTML.

Change-Id: I4b00d0b0efed9d91c0bc28914bbdf0955bb552b6
2020-11-04 21:04:40 +00:00
Bartosz Dziewoński 1626242863 Don't detect comments within headings
Bug: T267068
Change-Id: Id134f15e086fd070801c4b1d836dbfbf9bf444ad
2020-11-04 21:57:33 +01:00
Bartosz Dziewoński 31f6d44bf6 Move warnings stuff from CommentItem to ThreadItem
After recent changes allowing ThreadItems to have IDs, they can now
also have warnings about duplicate IDs.

Bug: T267035
Change-Id: If3edfe34e6e29741e29fac8946a3c88badc4ab7f
2020-11-02 20:07:23 +00:00
jenkins-bot f3c5d405b3 Merge "Switching editor modes would switch editor_interface before success/fail" 2020-10-30 23:19:06 +00:00
jenkins-bot 1baf837a19 Merge "ReplyWidget: Hide external links icons in the footer" 2020-10-30 17:43:22 +00:00
jenkins-bot 8f54ca44ac Merge "ReplyWidget: Fix exception when toggling the "Advanced" drawer" 2020-10-30 17:19:35 +00:00
Ed Sanders 6450cea848 Fix fetching of headline node with new HTML
This code path needs to work with new and old HTML
markup around headings.

Change-Id: I2291e407e68423b34fca4d53362680d97ab44a71
2020-10-29 15:41:26 +00:00
David Lynch b3186f8d6a Switching editor modes would switch editor_interface before success/fail
Also, stop the dialog-prevent-show event from switching editor_interface
just because it's tied to the `editor-switch` feature.

Bug: T259673
Change-Id: I2acf9d79add281ed0f62f022e44bb18948ceafc8
2020-10-28 21:59:32 -05:00
Bartosz Dziewoński 282c987efa ReplyWidget: Hide external links icons in the footer
Bug: T266686
Change-Id: I20debf936d73e4615b485e1b089616de8646e624
2020-10-28 18:07:43 +01:00
Bartosz Dziewoński 157d34c852 ReplyWidget: Fix exception when toggling the "Advanced" drawer
Bug: T266685
Change-Id: I9ba7761abbdeb1ee6f3449287923f7a77d85c531
2020-10-28 18:07:34 +01:00
Ed Sanders 3aca622894 Treat headings like comments now they have IDs
Use the same logic for marking ranges in the document, and ensure
that the heading range does not include section edit links or
section numberings.

Change-Id: I782caafc34fee2a822b0a17b24dd6b9528202eca
2020-10-28 12:38:18 +00:00
jenkins-bot 333486fd85 Merge "Add preference to expand the "Advanced" menu when replying" 2020-10-27 11:42:41 +00:00
jenkins-bot 6792c0c9c9 Merge "Include 'false' results in 'transcludedfrom' API response" 2020-10-27 11:38:52 +00:00
Ed Sanders 8aba15ec9c Pass uselang with API requests
Bug: T266195
Change-Id: Ib605a54cba62052044e96c6a3276bfd500d3a7cc
2020-10-23 12:32:00 +01:00
Ed Sanders 3b31aa669d Create controller.getApi method with defaults
Only share API objects when it is safe to do so.

Change-Id: I4810f59ce41c43f78e0b42db6b36620b2aca1cec
2020-10-23 12:30:37 +01:00
jenkins-bot 70cd85690f Merge "Fix some TODOs about test data" 2020-10-22 21:46:20 +00:00
jenkins-bot 1456e3d798 Merge "Add oldest timestamp in the thread to heading IDs" 2020-10-22 21:46:18 +00:00
jenkins-bot aeffdd5edd Merge "Disambiguate comments by parent ID, rather than sequential numbers" 2020-10-22 21:46:15 +00:00
jenkins-bot c9766dbbac Merge "Connect sub-threads to their parent threads" 2020-10-22 21:44:39 +00:00
jenkins-bot 8cd5dc386b Merge "Clear page data cache after posting a reply" 2020-10-22 21:37:13 +00:00
Bartosz Dziewoński 7ad6328223 Include 'false' results in 'transcludedfrom' API response
Skipping them could result in incorrect handling when RESTBase HTML is
outdated.

When a result for a given comment is not found, display an error
instead of assuming it is not transcluded.

Bug: T262065
Change-Id: I14a7a0a25d5181b5c49bd5677f0c002dce5a3cb9
2020-10-22 22:25:35 +02:00
Bartosz Dziewoński c72efee5ce Clear page data cache after posting a reply
We depended on the oldid (wgCurRevisionId) changing after a reply is
posted, but it will not change if we posted to a transcluded page.

Bug: T266275
Change-Id: I1baa1f2227134b73fd663de2fee3ea96a2f9b183
2020-10-22 21:52:05 +02:00
Ed Sanders 9b965c45b5 Set 'useskin' when using API action=parse
Bug: T266195
Change-Id: I65c3e71924e0e126cac95088a4c3774cee8e8a72
2020-10-22 21:31:49 +02:00
Bartosz Dziewoński 044bc50fb6 Fix some TODOs about test data
We avoided fixing these because it causes changes in just about all of
the test data, which is annoying when reviewing or blaming changes.

But the previous several commits also caused changes in just about all
of the test data, so we might as well do this too.

Change-Id: I83b64d83b6f12c04dc06c0cadff7cdd89417e137
2020-10-22 00:21:04 +00:00
Bartosz Dziewoński 0ddc171c8a Add oldest timestamp in the thread to heading IDs
To avoid old threads re-appearing on popular pages when someone
uses a vague title (e.g. dozens of threads titled "question" on
[[Wikipedia:Help desk]]: https://w.wiki/fbN), include the oldest
timestamp in the thread (i.e. date the thread was started) in the
heading ID.

Bug: T264478
Change-Id: If918bfd5e025248923d1939bc86916697ead95a0
2020-10-22 02:19:21 +02:00
Bartosz Dziewoński b09bbfe668 Disambiguate comments by parent ID, rather than sequential numbers
Sequential numbers aren't great because they change when an earlier
comment is archived. Parent comment/heading IDs should change less
often.

This also makes much more sense for disambiguating subsections,
e.g. a dozen identical ===Votes=== sections for a dozen proposals.

Bug: T264478
Change-Id: I466454984fd919ebef35f2b37ddb5d86dc842996
2020-10-22 02:19:21 +02:00
Bartosz Dziewoński 3137d76f40 Connect sub-threads to their parent threads
Our threads now also contain all replies to their sub-threads.
This is similar to how sections work in MediaWiki, where the parent
section also contains the content of all the lower-level sections.
We're going to need this for notifications about replies in a thread.

Bug: T264478
Change-Id: I241fc58e2088a7555942824b0f184ed21e3a8b6f
2020-10-22 02:05:02 +02:00
Bartosz Dziewoński 9ee0fd69f5 Allow headings to have IDs
Previously, only comments could have IDs, because we only needed IDs
for replying. But we might also use them for notifications soon.

Bug: T264478
Change-Id: I1bcad02bf17ab54bc5028a959543c10f0430836b
2020-10-22 02:04:28 +02:00
Bartosz Dziewoński 6719d17364 Handle cached "legacy" IDs (and other JSON-serialized data)
The output of CommentFormatter::addReplyLinks() and consequently
ThreadItem::jsonSerialize() can end up in the HTTP cache (Varnish) on
Wikimedia wikis. We need to consider that when changing that code.

Introduce a concept of legacy ID (generated by the older algorithm
after it changes), add some placeholder code that will generate them
in the future, and update some code to find comments by either normal
or legacy IDs.

Add dire comments in a bunch of places (as if that ever helps).

Bug: T264478
Change-Id: I4368f366800ab21b8b184b09378037614fdecd33
2020-10-22 00:53:06 +02:00
Bartosz Dziewoński 3b8d63467e CommentParser: Remove confused comments about references and objects
"This modifies the original objects…" – I feel like this is obvious
now, but maybe it wasn't so obvious when this code was structured
differently before a2431fe006. Also,
it refers to a variable that doesn't exist.

"FIXME this will clone the reply…" – No, actually, it will not.
It would if replies were associative arrays, but they are objects,
and have always been, ever since the PHP parser was merged in
7b7a2cd69c. Maybe they were arrays
once in Roan's mind before he pushed that for review.

Change-Id: I1348e111699fdbde99cd1f9ef45d8f465f7391b0
2020-10-21 21:01:27 +02:00
Bartosz Dziewoński 2f28cfdf56 Add preference to expand the "Advanced" menu when replying
* Add the preference
* Only display it when the reply tool is enabled
* Use it when opening the reply tool
* Save it when the menu is toggled from the reply tool interface

Bug: T261539
Change-Id: Icb8fa6b3f1e9a3644669f21b08f34ea8c175f2f9
2020-10-20 07:09:40 +02:00
Ed Sanders d0bcec6196 Enable DT server side via a cookie to preserve user enable hack
Bug: T265499
Change-Id: Ied330c633732651d1c4e136646afd676ceb570c7
2020-10-19 21:42:58 +01:00
jenkins-bot 8716fbf9e2 Merge "Add reply links on the server" 2020-10-13 20:46:53 +00:00
Ed Sanders 64392af485 Add reply links on the server
Bug: T252555
Change-Id: I4e60fdbc098c1a74757d6e60fec6bcf8e5db37c1
2020-10-08 13:27:08 +01:00
Ed Sanders dfdadee481 Simplify edit summary selection logic
Always select the default reply if it looks unchanged, i.e.
we see '...*/ Reply' at the end of the summary.

Bug: T263062
Change-Id: I0a79d9e5072d9d9df16c93435502f67524e2d2bc
2020-10-07 18:56:17 +01:00
jenkins-bot f9276d6b84 Merge "Ignore other empty-ish things at the beginning of comments" 2020-10-06 00:34:31 +00:00
jenkins-bot 6d5b41ad2c Merge "Remove number when reading heading node" 2020-10-05 23:22:35 +00:00
Ed Sanders eeefd985d6 Remove number when reading heading node
Bug: T264561
Change-Id: I0e6235f6b7169665e403fd6db1812fe90e8932b0
2020-10-05 21:58:51 +01:00
Bartosz Dziewoński be2ec55114 Work around Chromium bug with triple-click selection and reply links
Through trial and error, I found that adding `display: inline-flex;`
avoids the issue, and does not seem to have any negative effects in
Chromium or other browsers.

Bug: T260072
Change-Id: I9a9ca1fdb57bb7dd6c1a0a70e330a2a503c8ec8e
2020-10-02 19:17:34 +02:00
Bartosz Dziewoński ed17f640b6 Ignore other empty-ish things at the beginning of comments
Follow-up to 432a959436.

Bug: T264116
Change-Id: I0685cafab70c7e9d22f504f1a1309c9a28d6f2e1
2020-09-30 23:42:47 +02:00
jenkins-bot 91e87eb09a Merge "Fix detecting username from the wrong links sometimes" 2020-09-30 18:18:02 +00:00
jenkins-bot f7c7ba3c44 Merge "Ignore empty paragraphs at the beginning of comments" 2020-09-30 18:16:36 +00:00
Bartosz Dziewoński 17b7a481a2 Fix detecting username from the wrong links sometimes
When a timestamp directly followed a `<div>…</div>` tag (or perhaps
some other wrapper containing lots of content), we would detect the
username from the earliest links in the wrapper (furthest from the
timestamp), rather than the latest links (closest to the timestamp).

Bug: T262573
Change-Id: Id16449a86a731b13dc79846bb30ecf6554e26f1d
2020-09-29 22:31:24 +02:00
Bartosz Dziewoński 432a959436 Ignore empty paragraphs at the beginning of comments
The wikitext parser outputs `<p><br></p>` for empty paragraphs, so we
need to ignore `<br>` tags when searching for an "interesting" node
that marks the beginning of a comment. Otherwise the empty paragraphs
mess up the detection of indentation levels.

Bug: T264116
Change-Id: I84a97ab577baa7336b78935ccdc48041ecfc231a
2020-09-29 22:22:35 +02:00
Ed Sanders 6b8312e610 Ignore HTML comments which are more than two lines from a reply
Bug: T264026
Change-Id: I989132d7599a7fa156dba46d87a9ed4b76322c0c
2020-09-29 11:30:03 +01:00
jenkins-bot 75a3a62f0a Merge "ReplyWidget: Pass initial config values to #setup, not to constructor" 2020-09-25 21:51:20 +00:00
jenkins-bot c6e69d586f Merge "Fix vertical alignment of action buttons when logged out" 2020-09-25 18:18:43 +00:00
Bartosz Dziewoński 48d5a67d41 ReplyWidget: Pass initial config values to #setup, not to constructor
The same ReplyWidget instance can be re-used when the user cancels
replying and then starts replying again to the same comment.

Previously, the initial values passed to the constructor (when switching
modes) would still persist in this case, even if they were incorrect.

Bug: T263061
Change-Id: I3dff007456bfd4f3149c718ae72fbf373a2e2913
2020-09-25 20:00:00 +02:00
Ed Sanders 06d42957a5 Fix vertical alignment of action buttons when logged out
Bug: T263871
Change-Id: Id2c39b630ddbbd6232f67a161de3f74f36a7cd6b
2020-09-25 17:54:00 +00:00
jenkins-bot 197f103081 Merge "Disable find-and-replace" 2020-09-25 16:58:17 +00:00
Ed Sanders 6790e5c41c Disable find-and-replace
Bug: T263570
Change-Id: I075c1696f179eed2e0143c12082cee048c200227
2020-09-25 15:17:15 +01:00
Bartosz Dziewoński ca41a405ec Fix debug mode after language variant changes
Follow-up to 329df8c953.

Change-Id: I49f7d580a7e7c5dde7c234ca8905157e6a0f4f5d
2020-09-24 19:49:04 +02:00
jenkins-bot b1804fbb8b Merge "Add content getters to Thread/Comment items" 2020-09-21 22:35:24 +00:00
jenkins-bot e7206488a8 Merge "Collapse advanced drawer when clearing" 2020-09-21 21:08:03 +00:00
jenkins-bot db82dce31f Merge "Only reset summaryPrefixLength on user event" 2020-09-21 21:06:29 +00:00
jenkins-bot e4fa3d3593 Merge "Always send edit summary, regardless of visibility" 2020-09-21 21:06:28 +00:00
Ed Sanders e6b91ced43 Collapse advanced drawer when clearing
Bug: T263061
Change-Id: Ibcd95ce1c86548962b9b7ff7b62bd0d127f53b76
2020-09-21 20:52:47 +01:00
Ed Sanders 9d3eea5fdf Only reset summaryPrefixLength on user event
Bug: T263062
Change-Id: I323ce4dab0a430e2aeb906ae9cd5d6b48a179cff
2020-09-21 20:39:21 +01:00
David Lynch b988eca191 When preventing switching modes, don't log a type-specific action
Just log dialog-prevent-show.

Bug: T259673
Change-Id: I336ad745a3bd92b9a5d40fc0962be2084a6cc589
2020-09-17 16:52:32 -05:00
jenkins-bot 636ca06e7e Merge "Fix parsing links in Parsoid documents without short URLs" 2020-09-17 20:40:40 +00:00
Ed Sanders 5c2abccf2a Always send edit summary, regardless of visibility
Bug: T262501
Change-Id: If5a8837afc8d91f4d46db1d928142d775da010c1
2020-09-17 20:06:51 +01:00
jenkins-bot 328674d042 Merge "Parsing discussions converted to language variants" 2020-09-16 22:52:37 +00:00
Bartosz Dziewoński 329df8c953 Parsing discussions converted to language variants
* Export parser data (date format, digits, timezone names, and
  messages for weekday/month names) converted to language variants
* Update the parsers to try matching using every variant, in case
  the page is displayed in non-default variant (and to avoid
  problems with incomplete variant conversion)

Bug: T259818
Change-Id: I04d73992cd31ce06fa79f87df0c0a53d7efc3c58
2020-09-16 22:07:07 +00:00
jenkins-bot 53cb5a3b19 Merge "'transcludedfrom' API response is an object, not array" 2020-09-16 22:02:16 +00:00
jenkins-bot 75f073759f Merge "Bypass useless API requests on non-existent pages" 2020-09-16 20:40:01 +00:00
Bartosz Dziewoński 39f4bf8626 'transcludedfrom' API response is an object, not array
Change-Id: Ibad2190cdf79b677cdf021f3253d1f432860f6e6
2020-09-16 22:30:11 +02:00
Ed Sanders fe8c40759b Bypass useless API requests on non-existent pages
The reply tool will do nothing on a new page, but we will
soon have the new discussion tool here.

Change-Id: Id772f7cc1f8701d659f3c7209c07dc4eb857e1fc
2020-09-16 12:19:42 +01:00