Commit graph

1104 commits

Author SHA1 Message Date
Bartosz Dziewoński 52ae0f3152 Special:TopicSubscriptions: Use permalinks when available
When permalink data is available, display a permalink using
the current page title, instead of a plain link to the section
at the time of subscription.

Consolidate and clean up some existing permalink code.

Bug: T306373
Change-Id: Ie2f63cbfdbfa703530205201dfcfb0e5ad053b35
2024-04-04 13:44:06 +00:00
Dringsim afff10a932
Replace deprecated ChangeTags method calls with ChangeTagsStore
Bug: T360664
Change-Id: I14b676e74b277dfea62109fcca6881fea3763997
2024-04-01 09:00:39 +08:00
jenkins-bot f3df3dfa0a Merge "Setup grunt-tyops and fix" 2024-03-28 13:35:23 +00:00
Ed Sanders a70f411ee1 Setup grunt-tyops and fix
Change-Id: I372c3cc5bedaf800716bff68cadb2846a399a42a
2024-03-27 14:01:18 +00:00
Bartosz Dziewoński c44313a867 Fix autosubscribe on new pages with $wgDiscussionToolsAutoTopicSubEditor = 'discussiontoolsapi'
Broken by the introduction of 'nocontent' parameter in
6bf6105d2a.

Bug: T359751
Change-Id: I60d9a6f51e897ecdc68525151990212ecc171548
2024-03-27 00:51:14 +01:00
Bartosz Dziewoński dacef1a97a Clean up subscribe links/buttons
* Don't generate `<!--__DTSUBSCRIBELINK__...-->` placeholder comments
  (follow-up to Idb23b0f5e438d35ed74569ff50302c7fad5ba688)
* Remove unused method parameter
* Remove unnecessary pass-by-reference (only $tocInfo needs it)

Change-Id: Ie3348671c486de5bbd9f286772a8d145e3609bd5
2024-03-25 01:13:59 +01:00
jenkins-bot f22dabfb80 Merge "Move some doc comments to real type hints" 2024-03-23 01:36:33 +00:00
Umherirrender 6c005d293f Add explicit parentheses around mixed boolean operator
Mixing different binary boolean operators within an expression
without using parentheses to clarify precedence is not allowed (T358966)

Change-Id: I9e9c9531ab0fa373606b19a5865cec748a3f36ff
2024-03-23 00:52:30 +01:00
jenkins-bot bd09ad6801 Merge "Move [subscribe] links outside of <h2> tags" 2024-03-11 17:07:14 +00:00
Bartosz Dziewoński d2d2d914ce Move some doc comments to real type hints
Change-Id: I64e3f7123c803ae2576c8b05824698d78a691018
2024-03-11 14:13:17 +01: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 b16dd9dd96 Update PHPCS overrides
There's now a different rule for the same thing in
mediawiki/mediawiki-codesniffer v43.0.0. Also document the reason for
the override. Follow-up to 8b00546749.

Change-Id: I392ee10639ffda6de55b091555e8c3cadd2af485
2024-03-10 22:59:05 +01:00
Umherirrender 8b00546749 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I889efe00ac06fa857fc3ae063193368927bcff7a
2024-03-10 17:36:18 +01:00
Bartosz Dziewoński 9c9512ecf5 Move [subscribe] links outside of <h2> tags
Place the "[subscribe]" links used when the 'VISUALENHANCEMENTS'
feature is disabled in the same DOM position as the "🔔 Subscribe"
buttons used when it is enabled.

Recent changes in MediaWiki core caused them to move inside the
`<span class="mw-headline">`, breaking some gadgets (T13555#9615648).
Moving them all the way outside should avoid problems.

I don't remember why we placed them inside the `<h2>` tags, but there
doesn't seem to be any reason to do it now. It must have been easier
that way before we introduced the `<div class="mw-heading">` wrappers.

Note that I'm keeping the `<!--__DTSUBSCRIBELINK__...-->` placeholder
comments in case it turns out there is a reason, and we need to revert
this change. If everything goes well, they can be cleaned up in change
Ie3348671c486de5bbd9f286772a8d145e3609bd5 later.

Bug: T13555
Change-Id: Idb23b0f5e438d35ed74569ff50302c7fad5ba688
2024-03-08 21:18:53 +01: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 eeeb6e7eab Merge "Fix PHP getTitleFromUrl() when $wgArticlePath is '/$1'" 2024-02-29 17:53:16 +00:00
jenkins-bot c3ca1ef3c8 Merge "Remove TemporaryParsoidHandlerParserCacheWriteRatio hack" 2024-02-28 17:20:38 +00:00
Bartosz Dziewoński 6419c19d1e Fix PHP getTitleFromUrl() when $wgArticlePath is '/$1'
In this case, the generated regexp would match the '/local' part in
the generated URL. Prefixing 'https://local' is no longer necessary
since 10899af666.

Add tests for this, and some tests to cover T261711 as well.

Bug: T358321
Change-Id: Idf54deba13f30b799b7b8d17de1897bc90f95701
2024-02-24 02:03:17 +01:00
jenkins-bot 402f5de391 Merge "Support for core section heading formatting in post-cache transform" 2024-02-23 05:01:19 +00:00
Ed Sanders bf7dc0d983 ThreadItemStore: Only pass *Content*ThreadItemSet to insertThreadItems
We never a DatabaseThreadItem back into the database. If someone
wants to do this in the future they should be thinking very
hard about it first.

Change-Id: Ie073c030905e31d81cb75bc9c46d5bb7c5d85b04
2024-02-21 16:10:25 +00:00
Ed Sanders b4e4f30234 ThreadItemStore: Remove "ButTryHarder" from method name
This appears to reference the retry that happens due to
REPEATABLE_READ, but that seems like an implementation
detail so not really useful to have in in the function
name, nor does it disambiguate it from another function.

Change-Id: Iacc95b74f25c166545734818efb1b30e18a1754e
2024-02-21 15:56:32 +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
Bartosz Dziewoński 08f61b2609 Support for core section heading formatting in post-cache transform
We already supported plain headings without the 'mw-headline'
wrappers, but now we need to parse the 'id' from a different
attribute.

Needed-By: If04d72f427ec3c3730e757cbb3ade8840c09f7d3
Bug: T357723
Change-Id: If85f89c40834618f23dc0ace2e599efb3b6d5ed4
2024-02-16 20:28:53 +00:00
jenkins-bot 85f75fb8ed Merge "Parser: Minor code cleanup" 2024-02-16 12:40:19 +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
Bartosz Dziewoński fc4d70f9f5 ThreadItemStore: Add ->caller() in queries
It makes it easier to find the queries in debug logs in production.

Change-Id: I80f94d1fc8c49227218b07234e162445cc43ca00
2024-02-09 19:16:55 +01:00
Bartosz Dziewoński 6a1f2accee Parser: Minor code cleanup
We had some unused variables and roundabout checks.

Change-Id: I454b60ffa05c1cc12288c5de88c849a25aa35447
2024-02-08 16:59:04 +01:00
jenkins-bot 297f4f01dd Merge "Parser: Fix the main loop getting stuck on some signatures" 2024-02-07 22:01:56 +00:00
jenkins-bot c1049da7d5 Merge "Use Parsoid HTML to drive notifications" 2024-02-07 21:36:56 +00:00
Bartosz Dziewoński 9db35873a4 Parser: Fix the main loop getting stuck on some signatures
In certain cases the parser could go back rather than forward after
finding a signature, causing it to find the same signature forever
until it ran out of memory.

Test cases coming later in a separate patch.

Bug: T356884
Change-Id: I8ac72b05e5e4ed45e6119c012a69708c9d8eda29
2024-02-07 22:33:57 +01:00
Bartosz Dziewoński f7a8ba08fb Ignore transcluded items when finding permalinks
* Keep the information about this in the API result, which we were
  previously omitting
* Use it instead of duplicating the logic client-side

Bug: T356131
Change-Id: I7e7342e9d94a171b5ef56e646871c18c8c39c44c
2024-02-04 00:07:37 +01:00
Ed Sanders 8b99c1fbbe Add more search methods to findNewestRevisionsByHeading
In production, indexing the full history of every page will take
too long, so we can't rely on being able to find the target heading
text in the history of the current page.

When this search fails, fall back to the following searches:
* The heading appears in the current revision of a sub-page
* The heading appears anywhere on the wiki, but only once

Bug: T356276
Change-Id: I90e92cb9c85aaf6fb2355f842450981bbe6abf2d
2024-02-01 18:32:36 +00:00
Ed Sanders 8069585489 CommentParser: Ignore generated timestamp links
This will be present in parser cache output and can
sometimes be mistaken for user page links.

Bug: T356142
Change-Id: I800b23d8466f72affcadfa336aab07abf7f8d79e
2024-01-30 10:29:36 +00: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 184cd048f1 Merge "Refactor CommentFormatter->addTopicContainer()" 2024-01-18 01:16:07 +00: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
Novem Linguae 3436e2d9e9 Refactor CommentFormatter->addTopicContainer()
To get ready for the subtopic subscriptions feature, this patch
separates the code that adds the topic container from the code
that adds the subscribe button.

The idea is that in the future, an H3 would need a subscribe
button, but not a topic container. Whereas an H2 would need both.

Bug: T275943
Change-Id: I6a82773ed200dcb4083ac38a4d41838f639c097e
2023-12-24 13:34:30 -08:00
jenkins-bot 6ff126eab5 Merge "CommentFormatter: Do not add wrapper if the heading has attributes" 2023-12-20 17:17:18 +00:00
Bartosz Dziewoński 6f92654137 CommentFormatter: Do not add wrapper if the heading has attributes
Bug: T353489
Change-Id: Idf49b40cd745b804dbad3c09960507790be20ae3
2023-12-20 16:56:12 +01:00
jenkins-bot 2d2bcc05ce Merge "ContentCommentItem.php: Documentation fixes" 2023-12-18 17:21:36 +00:00
Ed Sanders 84bc45adf1 ContentCommentItem.php: Documentation fixes
Change-Id: I5ee1c3e1b79f4e9bdab417c68ff447313ecb752d
2023-12-15 17:05:22 +00:00
jenkins-bot 8e2d172960 Merge "CommentParser: Replace new uses of Title with TitleValue" 2023-12-15 16:21:19 +00:00
jenkins-bot bf9fc18120 Merge "Move finding transclusion source from ContentThreadItem to CommentParser" 2023-12-15 16:17:13 +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
jenkins-bot 797bd2ea0b Merge "ThreadItemStore: Omit redundant updates to avoid warnings" 2023-12-14 11:06:45 +00:00
Bartosz Dziewoński ab2a83601a Use SQL expression builder instead of buildLike()
Follow-up to c82783a5b6.

Change-Id: If844b601b3887d5f853fb9f56be2741896114698
2023-12-14 11:55:34 +01:00