Commit graph

329 commits

Author SHA1 Message Date
Bartosz Dziewoński 65951c19d2 Pass message parameters as variadic arguments
Soon to be deprecated in If2ebb6d17ffeacbd95f0ed147ae8f16f90578450

Change-Id: Iaaaa2bf745c2ddcfc6d6d3d15be5ce6f2968cfa8
2024-10-30 21:41:20 +01:00
Ed Sanders a85be7d7b5 Show empty state message if subject doesn't exist but talk page exists
If the subject page/user doesn't exist it usually makes sense
not to show the "Start a discussion about X" message, but when
the talk page itself exists but without any discussions
(e.g. after a Flow archiving), then we _should_ show message to
start a new discussion.

Bug: T378392
Change-Id: I20dab0089691ba7a429c9a50f23b9e3afe61aaaf
2024-10-29 09:54:26 +00:00
Umherirrender eef833a112 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: Ife9826099657bcaeca1beec94863a1600fdf55f8
2024-10-19 23:39:18 +02:00
Fomafix 22a66a8aa7 Use ?? instead of default value in getRawVal()
Bug: T376245
Change-Id: I2f997b9b39850bc5f2ed31e04f457f43eeb054a2
2024-10-02 10:52:51 +00:00
Ed Sanders 3dc503c43b Enable visualenhancements on archived talk pages
Bug: T374198
Change-Id: I50f566934bd0f3962741557ca24f1ef4af288eee
2024-09-06 10:00:28 +01:00
DLynch f96eba7e6e Revert "Invert logic on empty talk page"
This reverts commit 7e5f9b59a2.

Reason for revert: Causes empty state to always appear on wikis using Talkpageheader

Bug: T373100
Change-Id: I23a3f937201d93c7c7645a09c4fccfcf1c14008a
2024-08-22 17:48:33 +00:00
Arlo Breault 7e5f9b59a2 Invert logic on empty talk page
Record if a talk page is not empty, rather than empty.

This helps prevent Parsoid from mislabelling pages as empty when they
contain extension tags it needs to call out to the legacy parser to
process.  Metadata from the legacy parse is merged into the overall
metadata for the page.

For example, a templatestyles extension tag parsed in the context of a
talk page would set the empty state which would then fail to cleared if
the overall parse of the page wasn't empty.

Bartosz (@matmarex) proposed this idea in T371125#10053043

Setting and using these flags all appear to be post-retrieval from
cache.

Alternative to I1deb679ef0e19dc3a36e377c183dd1b4ab0003e9

Bug: T371125
Change-Id: I5c1877f7f9eb73f88a33e001ca3c2f3d06bb90e4
2024-08-14 18:26:25 -04:00
Bartosz Dziewoński a38ebc00d8 Restore "empty state" on existing but empty talk pages
The previous approach no longer works due to changes in MediaWiki.
We must now pass the data between the hook which has access to request
state needed to determine if we should show this, and the hook that is
capable of showing it in the right place.

Bug: T362496
Change-Id: I290422c4249d288badd7c7d25e5e7e435dfd1800
2024-07-09 19:31:55 +00:00
jenkins-bot 961d36f13e Merge "BetaPreferenceHooks: Reuse $this->config" 2024-07-03 16:08:26 +00:00
Fomafix c675410755 BetaPreferenceHooks: Reuse $this->config
Change-Id: I782da96af4786ce812665a1e08bd89cacc52747e
2024-07-03 15:14:47 +00:00
Fomafix b06b96b915 Inject services into DiscussionToolsHooks
Change-Id: If15fd7cca27832ed8ff6738c90556be701be269f
2024-07-03 15:00:54 +00:00
Fomafix f6c3c98bc3 Use service 'GadgetsRepo' instead of deprecated GadgetRepo::singleton()
Change-Id: I226b259e361d3d27ec89975353fdf6396ba60ccb
2024-06-30 09:03:11 +00:00
Ed Sanders 08d540f6b5 Disable beta feature automatically when all sub-features are available
Change-Id: I87886c894f652db339d3f07630366b3b4ff74e9e
2024-06-26 12:03:58 +01:00
Ed Sanders 66ddcf5b64 Remove A/B test code
It's unlikely we'll do another feature A/B test any time soon.

Bug: T322492
Bug: T341491
Depends-On: Ia3712e2930fcd971bce44f568430602ce3949f23
Change-Id: I1ef4191f9466b7420a2fead571615ed6d49f873e
2024-06-21 21:08:15 +00:00
jenkins-bot d8da88055a Merge "Remove WMF-specific "discussiontools-autotopicsub" settings" 2024-06-16 09:32:41 +00:00
jenkins-bot 7c9450489d Merge "Use ConditionalUserOptions for "echo-subscriptions-email-dt-subscription"" 2024-06-16 09:32:34 +00:00
Bartosz Dziewoński 0f601b690a Remove WMF-specific "discussiontools-autotopicsub" settings
WMF config change should be deployed first: Ica7dba4f17eb3e57a1a2415cc970c54a67eac696

The default value for this preference was already '1', and this code
was a no-op unless it was overridden to '0' like it was in WMF config.

Bug: T357221
Change-Id: I6b09bbea9bfb7a8f8ed17114dc59e657c5b66e91
2024-06-15 13:05:07 +00:00
Bartosz Dziewoński 488e35d82e Use ConditionalUserOptions for "echo-subscriptions-email-dt-subscription"
WMF config change should be deployed first: Iaff2d5ffee78d6200e1fa971c5c62137a400005d

Bug: T357221
Change-Id: I2744d52c5ff8c89166c19ab0ff2b4a27bfbf7cd7
2024-06-15 13:04:58 +00:00
jenkins-bot a3adda8ed7 Merge "Remove jquery.makeCollapsible workarounds for mobile" 2024-06-10 19:29:49 +00:00
Umherirrender 3dc5e88842 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I492ddae3c3e9f81d551ea8b348b7148893f4f590
2024-06-09 00:02:35 +02:00
Bartosz Dziewoński 2c9264e412 Remove jquery.makeCollapsible workarounds for mobile
The module is now loaded normally by the Minerva skin (T111565).

Bug: T323639
Change-Id: I9121410c20fffd651c81c26b84b861ec9300881f
2024-06-04 00:56:58 +02:00
Ed Sanders a86897f890 Comment thanking
Bug: T249893
Change-Id: I64f7abc26bfc3e7b226340934a637a555edf754f
2024-05-28 17:47:09 +02:00
Ed Sanders d1bffdee70 Use namespaced notification classes from Echo
Change-Id: I80377881e6aabf3014394c024fca6af50166aa1a
2024-05-28 15:48:56 +01:00
Amir Sarabadani 320da37512 Fix static cache access
Currently, DT is making more than 30 exact queries back to back in every
request. It is clear the caching is completely broken.

It is because when the properties don't exist (majority of the cases),
it returns an empty array making the caching noop.

Tested in mwdebug1002 and it fixes the issue.

Bug: T364693
Change-Id: I182ae121999df1a04cfb7399bc49891587a37074
2024-05-12 18:23:41 +02:00
Bartosz Dziewoński 69e8e948b2 Remove now redundant PHPDoc blocks
MediaWiki's PHPCS plugin requires documentation comments on all
methods, unless those methods are fully typed (all parameters and
return value).

It turns out that almost all of our methods are fully typed already.

Procedure:

1. Find: \*(\s*\*\s*(@param \??[\w\\]+(\|null)? &?\$\w+|@return \??[\w\\]+(\|null)?)\n)+\s*\*/
   Replace with: */
   This deletes type annotations, except those not representable
   as PHP type hints such as union types `a|b` or typed arrays `a[]`,
   or those with documentation beyond type hints, or those on
   functions with any other annotations.

2. Find: /\*\*/\n\s*
   Replace with nothing
   This deletes the remaining comments on methods that had no prose
   documentation.

3. Undo all changes that PHPCS complains about (those comments
   were not redundant)

4. Review the diff carefully, these regexps are imprecise :)

Change-Id: Ic82e8b23f2996f44951208dbd9cfb4c8e0738dac
2024-03-10 23:53:04 +00:00
Bartosz Dziewoński 4958416caf Only include one set of DiscussionTools buttons in the page HTML
We no longer need to support toggling visual enhancements without
reloading the page, so we can remove the extraneous set of buttons
to reduce HTML size.

Bug: T322457
Change-Id: I54e57c754c54b7e611069f9832d1ebabf141a396
2024-03-01 16:51:17 +00:00
jenkins-bot c3ca1ef3c8 Merge "Remove TemporaryParsoidHandlerParserCacheWriteRatio hack" 2024-02-28 17:20:38 +00:00
Ed Sanders 5ba0bfa026 Remove temporary newsectionlink_enable config
This was intended as a temporary config to facilitate a
staged rollout (T331635) which has now completed.

Change-Id: I432ec0a24b8e8c12b62556ff6703abff32a2fced
2024-02-19 17:34:23 +00:00
Subramanya Sastry 3b2de5b10e Properly handle preview scenario for Parsoid rendering
* Removed a wikiech-specific hack and use the now available
  ParserOutput flag.

Change-Id: Ia06025c131485a9dc67afd8258fa4b3753d165b9
2024-02-14 15:32:47 -06:00
C. Scott Ananian e2fbc0704c Remove TemporaryParsoidHandlerParserCacheWriteRatio hack
This was originally supposed to be released before MW 1.40.

Bug: T355375
Change-Id: I9cf0631ebb25db5ad7cf1c3c1011fc40c33c9891
2024-01-18 19:23:36 -05:00
C. Scott Ananian e2c9ca37b0 Use Parsoid HTML to drive notifications
This reuses the existing comment parser code in HookUtils and makes the
DataUpdatesHooks and EventDispatcher code consistent.

Bug: T354792
Change-Id: I58a71b26b3f47898a68a29098a8105ee844403dd
2024-01-18 19:23:13 -05:00
jenkins-bot 55daf9b617 Merge "Re-enable: "Temporarily disable isPreview in Parsoid's rendering""" 2024-01-17 19:47:11 +00:00
Subramanya Sastry 3f2f5dd237 Re-enable: "Temporarily disable isPreview in Parsoid's rendering""
This reverts commit 1cf6000d18.

Reason for revert: Want to do another round of visual diff testing
on wikitech as an anonymous user. Will revert this after test is done.

Change-Id: Ic3facb7ecd9c932be348d47d6a38cff71cd7e1db
2024-01-17 18:02:16 +00:00
Ed Sanders c076f170c4 Update TODO documentation around parsing
Change-Id: I14fb4874fdc3e97418b5f41665334e122c17d862
2024-01-10 18:29:40 +00:00
jenkins-bot a77338fd6d Merge "Revert "Temporarily disable isPreview in Parsoid's rendering"" 2023-12-14 17:24:02 +00:00
Subramanya Sastry 1cf6000d18 Revert "Temporarily disable isPreview in Parsoid's rendering"
This reverts commit d004c001be.

Reason for revert: Visual diff done and results gathered.

Change-Id: Iefb0c74a121346286a353dae6cb795b86aa636ce
2023-12-14 14:16:41 +00:00
Subramanya Sastry d004c001be Temporarily disable isPreview in Parsoid's rendering
This will let us render reply links on wikitech and run visual diffs
(which runs in anonymous user mode). This will be reverted after
the visual diff test run.

Change-Id: Ibf175a7f5b1e68f66c257fc26ba9e4b55f752fbd
2023-12-12 14:08:46 -06:00
Subramanya Sastry 8671171b35 Remove checks for missing title info in ParserOutput extensiondata
This data was added to core in I328f533e6cdb11c0c3a873d23bab1a113dfa39be
and it will have been in production for 4 weeks next week which is
enough for all content to have rolled over.

Change-Id: I3d568eed56446f26aa329bfa554d609b8bcb973a
2023-12-12 14:08:46 -06:00
Umherirrender 64bcb583e9 Use namespaced classes
Done automatically via script
Change to extension.json done manually

Change-Id: Ied7bbddd357290ac6be6bf480be0ee9116e77365
2023-12-11 16:38:02 +01:00
jenkins-bot 957788d9d5 Merge "Use upstream Title::inNamespace() instead of manual comparisons" 2023-12-04 23:09:28 +00:00
gerritbot 5a51c63687 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Iaf161106c323461929abe9b8a021bbb3e34c4ae7
2023-11-30 17:35:15 +00:00
thiemowmde 12e7fba827 Remove small pieces of unused code from PageHooks class
Change-Id: I557bfb0f688d3e9455b5187df3cbbe67697fbd55
2023-11-28 15:39:20 +00:00
thiemowmde 00ad50c673 Use upstream Title::inNamespace() instead of manual comparisons
This might be a matter of personal preference. Not sure if it's
worth it. Both is well readable. On the other hand, the method
exists. Why not use it?

Change-Id: Id66fc6c888db6ae1cf28e60a51f90d9ae2cdb6ee
2023-11-28 09:49:00 +01:00
Subramanya Sastry e42450cd4f Revert "ParserOutputPostCacheTransform: Don't reprocess content"
This reverts commit 7aaaf51dfd.

Reason for revert: This is not right and doesn't work either.
See T351461#9358034 for why this strategy will not work right now.
We need a different strategy to prevent duplicate transforms if
they continue.

Change-Id: I97efee9197359ecdccdf89a0be850a707a11cc98
2023-11-26 22:06:39 -06:00
Subramanya Sastry 7aaaf51dfd ParserOutputPostCacheTransform: Don't reprocess content
* getText() could be called multiple times on a ParserCache object
  which would fire the ParserOutputPostCacheTransform handler
  multiple times.

  But, I could not track down how this could happen right now.

* As a separate issue, while conceptually there are no restrictions
  against calling getText() multiple times, there is a semantics and
  performance issue if that did actually happen. getText() does a
  bunch of transformations and makes no effort to avoid duplicate
  work. It will accumulate more transformations over time via the
  OutputTranform pipeline and it is preferable for getText() and/or
  the OutputTransform pipeline to guarantee semantics where the
  pipeline won't be run multiple times on the same content. That will
  free both hook handlers (like this) and the transforms themselves
  to avoid checks as in this patch.

  This patch should be reverted once such a change is made to core.

Bug: T351461
Change-Id: If5dfa0954e3fd2b7dbea1ed29b475be07f0f3986
2023-11-20 13:31:43 +00:00
jenkins-bot 43df071836 Merge "Document generated CSS classes" 2023-11-16 21:03:28 +00:00
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
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