Commit graph

3834 commits

Author SHA1 Message Date
Subramanya Sastry a1c5130414 Add ParserOutputPostCacheTransformHook handler for Parsoid HTML
* This patch enables DT to work with Parsoid HTML without changing
  the functionality for legacy HTML.

* The code comments document some of the decisions being made here.
  Some of these decisions are temporary and need better solutions
  but this patch will let us run visual diff tests and expose any
  other latent bugs.

TODO
----
* We need to add new tests to verify CommentFormatter expectations
  for Parsoid HTML. I'll tackle this in a followup patch.

Known issues:
-------------
* Performance: Since the getText() transformed output in ParserOutput
  is not cached, if DiscussionTools is to switch over to Parsoid HTML,
  we have to add some form of caching of the transformed output because
  transformHtml can take a couple seconds in the p99 case which is too
  long to render uncached!

* Longer-term: Since this hook is called when getText() is
  called, all calls to getText() will now invoke this handler
  (which will return but still has to do a bunch of checks to
  determine this won't apply). Presumably, transformHtml() is
  idempotent because when some other code (other extensions, for ex)
  calls getText(), we will run the transfromHtml() on previously
  transformed content.

  My understanding is that getText() is going the way of the dodo
  and that getText() callers will have to explicit call the output
  transform pipeline code (and presumably this issue of repeatedly
  calling the same transforms on previously transformed content will
  be addressed there).

* Some CSS doesn't apply to Parsoid HTML because intervening <section>
  tags interfere with existing query selectors -- will be addressed
  separately.

Bug: T341010
Change-Id: I9846193656cdc658f5237df0a133d9d4dcc20d00
2023-11-09 18:37:56 +00:00
Ed Sanders 21e60ddeb1 Document generated CSS classes
Change-Id: I4a60e2faa81585b94b485b33ba0052a90d3f618b
2023-11-09 12:45:22 +00:00
Translation updater bot 4613058afb Localisation updates from https://translatewiki.net.
Change-Id: I89576f4164420140c0446885b9d84dd276c361c7
2023-11-09 10:40:35 +01:00
Translation updater bot 9b8088acab Localisation updates from https://translatewiki.net.
Change-Id: Ia58d7ff6e32b099a145bc44c4da419dbdcec6e38
2023-11-08 13:07:29 +01:00
David Lynch b3a838fc38 Notify when we can't find a comment from a reply-link
This requires something like an invalid timestamp, to produce a reply
link whose associated comment ID is going to not be findable.

Bug: T350633
Change-Id: Ib50c11096b9af9961b74309b60524a4b986e04aa
2023-11-07 11:59:03 -06:00
Translation updater bot 61586134a7 Localisation updates from https://translatewiki.net.
Change-Id: I671e3558d72316c5ca6167f9a65e344605af6c78
2023-11-07 09:07:42 +01:00
Translation updater bot a801e65cc9 Localisation updates from https://translatewiki.net.
Change-Id: I951f1b1d2ec091e7eeb05d1e6b89318a5698b522
2023-11-06 08:56:09 +01:00
David Lynch f8954ca466 Fix typo in discussiontools-emptystate-desc-self-temp
I'd reversed the order of "to access".

Bug: T338171
Change-Id: I6c8e8007dd74447230e73f5ccc9be46bfd73a4c9
2023-11-03 21:01:58 -05:00
David Lynch c6dc42ad97 Update temp account copy for empty states
Bug: T338171
Change-Id: Id74bf31ace60afb9ff623bf3c135fcb0c1b5ef76
2023-11-03 18:12:30 -05:00
jenkins-bot e55905ddeb Merge "Use top alignment for buttons on mobile talk pages" 2023-11-03 21:11:32 +00:00
Ed Sanders e0a841fe0a Use top alignment for buttons on mobile talk pages
Bug: T344629
Change-Id: Ic81a146e57fd00f2a9d83686e91d9424c2e404bd
2023-11-03 18:58:19 +00:00
Bartosz Dziewoński 5b1013124d ApiDiscussionToolsEdit: Remove unnecessary checks
According to EventLogging 'editattemptstep' data the error hasn't
happened in the last 90 days, and according to Logstash data the
warning hasn't happened in the last 90 days either.

The problem this guards against shouldn't be possible in a world
without RESTBase, but keep the checks as assertions just in case.

Change-Id: Id7eaf14294f8a7bb877f6a0e00a90976e560fc54
2023-11-03 16:55:06 +01:00
Translation updater bot 3a106cbcf1 Localisation updates from https://translatewiki.net.
Change-Id: Icfc21518eb5c80491614a2944e39628dd6302255
2023-11-03 08:58:48 +01:00
jenkins-bot ad21432602 Merge "Update autocreate warning copy for editors" 2023-11-02 22:12:39 +00:00
jenkins-bot e2f396fc99 Merge "Rewrite ImmutableRange::findCommonAncestorContainer for speed" 2023-11-02 18:41:29 +00:00
jenkins-bot 9db081c8b0 Merge "Document generated messages" 2023-11-02 17:47:18 +00:00
Ed Sanders be02707e10 Document generated messages
Change-Id: If91a32a48055b5f7d408151c7d2845f07ebd5e27
2023-11-02 16:29:54 +00:00
thiemowmde e739e6c4df Rewrite ImmutableRange::findCommonAncestorContainer for speed
While this method is not a huge bottleneck in this codebase it still
sticks out because it calls end() and array_pop() literally millions
of times. (Tested by running the unit test suite, which currently
takes about 30 seconds on my machine.)

Because of the way the method is used in this codebase (see especially
ImmutableRange::computePosition) $a is almost always a sub-element of
$b, or the other way around. It's almost never necessary to go all the
way up to the root element. We can use this additional knowledge and
stop much, much earlier. The extra code is worth it because we know it
will succeed very, very often.

When I measure the runtime of this method alone it goes down to less
than 1% of the previous runtime. The final loop at the end of the
method is almost never executed now (about 30 times in 15,000).

I also micro-benchmarked the final loop and optimized it to work with
passive array-indexes instead of actively manipulating the array with
array_pop().

Change-Id: Iffcaa8848780a85fde38e322649050c687567f29
2023-11-02 13:57:23 +01:00
Translation updater bot e3f49a3677 Localisation updates from https://translatewiki.net.
Change-Id: I3e0fba313c1108f36016f4b09662e386dc9ee634
2023-11-02 09:58:31 +01:00
jenkins-bot ef28fbfc84 Merge "ReplyWidget: don't show the enter hint if the reply button is disabled" 2023-11-01 17:58:36 +00:00
jenkins-bot e729df2bfe Merge "ReplyWidget: don't show the enter hint if the target was in bodyWrapper" 2023-11-01 17:58:28 +00:00
Translation updater bot 612c937727 Localisation updates from https://translatewiki.net.
Change-Id: I8cce589984dc2b99528f0c5315a40c15edfc48a9
2023-11-01 09:08:10 +01:00
David Lynch 147d6fc90b Update autocreate warning copy for editors
Bug: T338171
Change-Id: I25fb65bfe5f97d4d072db038b33cbb157b315efd
2023-10-31 20:07:05 -05:00
jenkins-bot 048d5364e2 Merge "Replace preg_replace_callback with strtr in CommentParser" 2023-10-31 13:35:19 +00:00
jenkins-bot 489a36e368 Merge "Switch out ParsoidOutputAccess for ParserOutputAccess" 2023-10-31 13:35:16 +00:00
Translation updater bot f1df4ed269 Localisation updates from https://translatewiki.net.
Change-Id: I175bc87a950e70d10569e82ae429026710e1e001
2023-10-31 09:08:49 +01:00
thiemowmde 10dcd1f847 Replace preg_replace_callback with strtr in CommentParser
It does the same as before.

I think performance is not a concern here, and wasn't my motivation
either. But I hope this makes the code easier to read and to reason
with.

I added a pure unit test case (without involving an actual Language
object) to cover the previously uncovered digits feature.

Change-Id: I6a0fc86035817eabb42b55e58183ae094c052aa6
2023-10-31 08:55:40 +01:00
C. Scott Ananian ca9c82741c Switch out ParsoidOutputAccess for ParserOutputAccess
Bug: T311648
Depends-On: I386b4a9b791065fb39dcfb2cb6df9f321d540ae1
Followup-To: I20de2e2391e45b7ccc9233d6d8306ad47462605f
Change-Id: Id32ec32ebdafe71b9f69f8b960e05a2afc9f7bce
2023-10-31 00:22:11 -05:00
jenkins-bot bfaefe4d4b Merge "Improve performance of CommentParser::getUsernameFromLink" 2023-10-30 23:33:33 +00:00
jenkins-bot c2e2381c06 Merge "Remove obsolete check for window.history.replaceState" 2023-10-30 23:06:12 +00:00
jenkins-bot 08e219a0a4 Merge "Optimize performance of very hot code paths in CommentUtils" 2023-10-30 18:07:58 +00:00
jenkins-bot 22926861b4 Merge "Localisation updates from https://translatewiki.net." 2023-10-30 17:46:01 +00:00
jenkins-bot 7f4de2aa93 Merge "Simplify preg_replace_callback in ApiDiscussionToolsPreview" 2023-10-30 17:36:29 +00:00
thiemowmde 1491b47b12 Improve performance of CommentParser::getUsernameFromLink
I was curious why running the CommentParserTest takes so long. I
found this is one of the bottlenecks because it's called so often,
but many link titles that are parsed as user names turn out to be
something else. This little hack speeds up the test by 15% and has
probably a similar impact in production scenarios.

Change-Id: I5a0b3a49ba5793c8a345baaa7118fed500c082b6
2023-10-30 17:59:46 +01:00
Translation updater bot 1a7b0523db Localisation updates from https://translatewiki.net.
Change-Id: I6f4e4d3e93417f0f9f0e344e3dfac276327b3536
2023-10-30 17:59:05 +01:00
thiemowmde bbe5bed02d Optimize performance of very hot code paths in CommentUtils
I was curious why running some of the PHPUnit tests in this code base
takes so long. While I could not spot an obvious bottleneck I found
a lot of code that is extremely hot, e.g. called a hundred thousand
times. A few obvious optimizations are possible in this code, e.g.
not calling the surprisingly expensive DOMCompat::getClassList
multiple times.

Change-Id: If22bbc1aedd2c36db1ab2343de5737009050b7bb
2023-10-30 17:29:32 +01:00
Ed Sanders 7ab38effce Fix vertical position of [(un)subscribe] links
Bug: T349866
Change-Id: Iaa740ce89c294dbd5274fc505ac6f61b00333eae
2023-10-30 16:03:55 +00:00
jenkins-bot 30875d1ac2 Merge "Remove old -ellipsisButton CSS class" 2023-10-30 10:25:51 +00:00
thiemowmde b2dd787039 Remove obsolete check for window.history.replaceState
I think we can remove this by now with the current browser support
matrix.

Change-Id: I6fc7b9c3d9b13ab920da75dd35ca8fdf01a318ee
2023-10-30 09:43:46 +01:00
thiemowmde 07c051ba75 Simplify preg_replace_callback in ApiDiscussionToolsPreview
There is nothing in this preg_replace call that needs to be executed
"as code". A normal preg_replace can do the same.

The pattern looks a bit different but really does have the exact same
effect as before.

Change-Id: I3597d632f2ecbe5b7ccef39a394075327c9bea79
2023-10-30 09:12:21 +01:00
thiemowmde 28ebaae999 Drop meaningless VisualEditor version number 0.1.2
This number is from 2020. It's meaningless by now.

Required for Iaa56abb.

Change-Id: Iaae0ac43174f471d8d210958704f98182e9979c5
2023-10-30 09:03:13 +01:00
Ed Sanders f2265f918f highlighter: Show a different message for missing heading links
These are not widely used anywhere, but linking to an #h- heading ID
that doesn't exist should say "topic not found" rather than
"comment not found".

Change-Id: Ifd269cc72e640f36431f85c751874ca06229ba9f
2023-10-28 15:28:30 +01:00
Translation updater bot cb26bb912f Localisation updates from https://translatewiki.net.
Change-Id: Ic67ee305cea1a87d8fd78f8b6507e4fb548dfffc
2023-10-27 09:20:02 +02:00
jenkins-bot ee8a898f69 Merge "Use VE shortcut-generation code for replywidget button labels" 2023-10-26 16:47:18 +00:00
jenkins-bot 8ca33158c3 Merge "Use type hints for properties, remove PHPCS overrides" 2023-10-26 16:42:10 +00:00
David Lynch 0b64a1a52c Use VE shortcut-generation code for replywidget button labels
Now that the base ReplyWidget depends on VE.

Change-Id: I6bd2bf1b0867a0aeae8e94e35a2e765cad3e72f4
2023-10-26 16:29:08 +00:00
Translation updater bot e628cb0b03 Localisation updates from https://translatewiki.net.
Change-Id: I07ed65b8ffa75f6b25c90ba57ff83720ef05a18d
2023-10-26 11:03:54 +02:00
jenkins-bot c3269996a3 Merge "styles: Use new forward-facing breakpoint tokens" 2023-10-25 13:06:30 +00:00
Translation updater bot 62b93381bd Localisation updates from https://translatewiki.net.
Change-Id: If7c3b458f920aad281f7760a0e0d83c8f98a7749
2023-10-25 09:02:11 +02:00
Volker E 728db90e88 styles: Use new forward-facing breakpoint tokens
Replacing legacy breakpoint variables with new Codex
design system `@max-width-breakpoint-*` tokens.

Bug: T331403
Change-Id: Ib1ff07a7692948b1fd22e9620c132133d392dab9
2023-10-24 23:43:06 -07:00