Commit graph

1188 commits

Author SHA1 Message Date
jenkins-bot cf73396835 Merge "Improve handling of Parsoid resource limit exceeded exceptions" 2024-11-28 04:42:43 +00:00
Bartosz Dziewoński 0b1919af0c Improve handling of Parsoid resource limit exceeded exceptions
Follow-up to 3d9585acbe.

* Avoid deprecated method StatusValue::getErrors()
* Don't use exceptions for control flow
* Don't re-use Parsoid's ResourceLimitExceededException,
  it seems unexpected to me and might limit future refactoring
* Use dieStatus() instead of dieWithException(), which will produce
  better localised error messages
* Add missing error handling in ApiDiscussionToolsThank

Change-Id: Ia032025f92f1c3cc0d62a0f45925dddba93fb42f
2024-11-28 04:09:44 +01:00
jenkins-bot ce05e417e9 Merge "Use faster DOMUtils::hasClass()" 2024-11-23 04:03:21 +00:00
jenkins-bot c049828dce Merge "Make use of the modern ??= operator in one more place" 2024-11-20 20:19:15 +00:00
jenkins-bot 4be9db5ef3 Merge "ApiDiscussionToolsPageInfo: Show nice error for deleted revisions" 2024-11-20 19:56:42 +00:00
Ammarpad 6e17c85409 ApiDiscussionToolsPageInfo: Show nice error for deleted revisions
This is similar fix as b8a28d6cfc.

Bug: T380351
Change-Id: I1b03a00c5627e1fa9e48aee9e2ed3d8b1ea332f7
2024-11-20 19:40:34 +00:00
thiemowmde 3cc4e00647 Use faster DOMUtils::hasClass()
I tried to benchmark this. It's not really a big bottleneck in this
codebase, but can still be seen. For example, the relative runtime
of the method CommentUtils::isCommentSeparator (the heaviest user of
this feature) goes down from 1.5% to 0.3%.

Depends-On: If9252a97562542e7a4bec29edcc6e8dee0fb8221
Change-Id: I6b94a2481b5c4f7983df78ee48d45c0d8a50e53b
2024-11-20 08:16:31 +01:00
thiemowmde f59335d85a Make use of the modern ??= operator in one more place
Change-Id: I57c56547893536cd1ca4de567158eccdfff508f9
2024-11-20 08:13:29 +01:00
thiemowmde eb65077dd8 Fix mistakes in inline @var comments
Change-Id: Idca575d4a6dd69b30f3ccb6b4dccadb38721780d
2024-11-20 08:11:59 +01:00
jenkins-bot 5dec8076e2 Merge "commentparser: Allow signature of user '0' to be detected" 2024-11-18 18:54:48 +00:00
Ammarpad 84d0dfc51c commentparser: Allow signature of user '0' to be detected
Bug: T379918
Change-Id: I11a447c11fe64dae88a5035b007fe762a335e6c5
2024-11-15 19:02:43 +01:00
jenkins-bot 98e1b4a34d Merge "Handle hidden revision in more places" 2024-11-04 22:58:30 +00:00
jenkins-bot 197affa825 Merge "Pass message parameters as variadic arguments" 2024-11-04 10:46:13 +00:00
Ammarpad ad99faef19 Handle hidden revision in more places
Instead of checking section->exists() everywhere we have to call
getTruncatedSectionTitle(), override the method inside
PlaintextEchoPresentationModelSection class to make it always
return string for our case.

Call to getTruncatedSectionTitle() in the following classes now use
the method override:

* RemovedTopicPresentationModel
* SubscribedNewCommentPresentationModel
* AddedTopicPresentationModel

The call to getTruncatedSectionTitle() in CommentThanksPresentationModel
does not need nor use the override.

Bug: T378261
Change-Id: Ibe985da5c1a79c5a1853d9c4896f8769cce6ddfd
2024-11-02 22:15:34 +01:00
libraryupgrader f631ba47ad build: Updating mediawiki/mediawiki-codesniffer to 45.0.0
Change-Id: If3efcd4428b5b5e75a0237ad640d9cf4f8c83c26
2024-11-02 06:55:33 +00:00
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
jenkins-bot 784c28ff70 Merge "Show empty state message if subject doesn't exist but talk page exists" 2024-10-29 15:01:38 +00: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
jenkins-bot 53b6a17980 Merge "Notifications: Handle suppressed topic titles in notification" 2024-10-26 22:19:13 +00:00
Ammarpad 4a25a985ff Notifications: Handle suppressed topic titles in notification
EchoPresentationModelSection::getTruncatedSectionTitle() has a note that
it should not be called if ::exists() returned false. Among the reason
the section may not exist includes suppressing the revision where the
topic title was added or edited.

Add placeholder message text "(topic removed)", to be used in place of
the unavailable topic title. This is analogous to "(user removed)" which
would be shown along if the username is also suppressed.

Bug: T378261
Change-Id: I6db0872b8724323a5e15eb6a262c2c3d0bdd630d
2024-10-26 15:10:35 +01:00
Andre Klapper 3b67d12a46 Use explicit nullable type on parameter arguments (for PHP 8.4)
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I40b301271ea0ae5d9123b06841eb8d3e4f9fbf86
2024-10-26 14:59:53 +02:00
Umherirrender fef98c5ebe Use type-declaration on api module constructor
Parent class constructor gets type-declaration in 1145328459

Change-Id: I5ec4767b386317b777846edd88d800f80b3bb360
2024-10-25 19:14:20 +02: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
Arlo Breault 4399d9a458 Always set a value for isEmptyTalkPage when transforming html
For interface messages, like the talk page header, tranformHtml isn't
run so no value is set while parsing it.  The double negative in
I5c1877f7f9eb73f88a33e001ca3c2f3d06bb90e4 failed to account for that and
was reverted in I23a3f937201d93c7c7645a09c4fccfcf1c14008a.

By always setting a value, we'll overwrite a value that may have been
set when Parsoid calls the legacy parser to parse extension content for
which it doesn't have a native extension, which then gets merged into
the metadata for the main parse.  However, setting with a different
value is deprecated and will eventually throw, but we already need to
find a solution for T372592 so what's one more.

Bug: T371125
Bug: T372592
Change-Id: Id73a1b5751cfc055e84188bcb19583c72b84032f
2024-09-20 18:17:16 -04:00
Arlo Breault 40f85d8852 Revert "Document shortcoming of CommentFormatter::isEmptyTalkPage"
This reverts commit 8245b94c4c.

No longer relevant after the revert in f96eba7.

Change-Id: Id81e68b4eaacb4b8a594ac97f75f1a7f5540b78c
2024-09-20 18:15:24 -04:00
David Lynch 9492fcc1f8 Find comment: limit DB query for page comments, use a custom exception
Follow-up to b7af4e87f5

Bug: T374598
Change-Id: Ibc958f84991198ebb616cf41258e70968353f7fe
2024-09-18 11:43:59 -05:00
Ed Sanders b7af4e87f5 Find comment: Don't show notice if "talk" page has never had any discussions on it
Some extraSignaturesNamespaces often have pages which are never
used as talk pages. This check will suppress "topic not found"
messages from appearing on those pages.

Bug: T374598
Change-Id: I0073807b7f0291fb64aab54a19a4c05fceff968c
2024-09-13 11:52:02 +01:00
Ed Sanders 3dc503c43b Enable visualenhancements on archived talk pages
Bug: T374198
Change-Id: I50f566934bd0f3962741557ca24f1ef4af288eee
2024-09-06 10:00:28 +01:00
jenkins-bot f57ee98ee8 Merge "Revert "Invert logic on empty talk page"" 2024-08-22 18:29:00 +00: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 8245b94c4c Document shortcoming of CommentFormatter::isEmptyTalkPage
Follows-Up: I5c1877f7f9eb73f88a33e001ca3c2f3d06bb90e4
Change-Id: Idb74807c105062f81954917fe4e8296be2b428f6
2024-08-16 12:28:02 -04:00
jenkins-bot ccb4ad5c7a Merge "Revert "CommentFormatter: Switch from deprecated addJsConfigVars to new setJsConfigVar"" 2024-08-15 21:43:31 +00:00
jenkins-bot 2a6100b294 Merge "Invert logic on empty talk page" 2024-08-15 20:56:39 +00:00
Bartosz Dziewoński 3ec0789d06 Revert "CommentFormatter: Switch from deprecated addJsConfigVars to new setJsConfigVar"
Silence the deprecation warning instead to avoid regressing T372193.
I filed T372592 about the bigger problem we have here.

This reverts commit fe8526caf2.

Bug: T372499
Change-Id: I47884f99e9c18fffd22ffdc27f5c61515b60c8f8
2024-08-15 19:52:29 +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
Arlo Breault 69fd71b260 Parsoid's templated content have other attrs as well
Bug: T372019
Change-Id: Ic1d32570f5fed4d48a126d0ef4c8c04a82d7bbb4
2024-08-14 17:30:31 -04:00
Máté Szabó 55665a3f93 Avoid primary DB query for non-talk page edits
While investigating primary database queries as part of T370304,
we found that EventDispatcher currently issues a primary DB query
to fetch the previous revision of the newly created revision on
every edit, but discards the result for non-talk pages. So, as an
optimization, have it fetch the previous revision only after the page
has been established to be a talk page.

Bug: T370304
Change-Id: I301f5c3c002c6953ef0b3919a33667a809342b84
2024-08-14 18:18:02 +02:00
James D. Forrester fe8526caf2 CommentFormatter: Switch from deprecated addJsConfigVars to new setJsConfigVar
Bug: T372193
Change-Id: Ib3ec31ac78aee59325b3b1be3bb66f5c4a73715a
2024-08-10 13:51:50 +02:00
Amir E. Aharoni 15f3f80378 Consistent spelling of "subpage"
"Subpage" is usually written as one word
in core and in other extensions.

Change-Id: Ie10a500790c321e866c02264d55449e42b0110bb
2024-08-06 03:44:51 -04:00
Umherirrender 2a932e598c Use expression builder instead of raw sql
Change-Id: I0cb5fa07d63bc93089a4956097eee7a41dbc99e7
2024-07-21 23:25:41 +02: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 3c76c7918b Inject service ContentLanguage into ThreadItemStore
Change-Id: Ie9b7d462c8ddf4abb749ee07537ccec1949b8fba
2024-07-03 10:16:27 +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
jenkins-bot 7281eec5b2 Merge "Improve unwrapFragment() for multi-paragraph comments" 2024-06-22 09:48:56 +00:00
jenkins-bot da90f4b049 Merge "Remove A/B test code" 2024-06-21 21:35:20 +00:00