Commit graph

1112 commits

Author SHA1 Message Date
jenkins-bot 9f7de3e917 Merge "Remove the "offset" from getHeadlineNodeAndOffset()" 2024-04-30 16:48:54 +00:00
Bartosz Dziewoński 67bad433dc Fix signature check not to look at the content of previous section
It needs to only look at the end of the added comments, and ignore
whatever is going on at the beginning, since the only thing it really
cares about is a functioning "Reply" button at the end.

Bug: T363285
Change-Id: Ia337be754deda741617d1343972f3e0a21c41b05
2024-04-25 23:15:18 +02:00
Bartosz Dziewoński 7445294b3b Remove the "offset" from getHeadlineNodeAndOffset()
Since c6cd20f682 the offset is always 0.

Change-Id: I9c1c8230f897d8bb287ca47056f5fa9fb187d060
2024-04-20 00:34:32 +02:00
jenkins-bot 56b21c9032 Merge "Remove workaround for T357812" 2024-04-17 15:22:35 +00:00
jenkins-bot 03a3c4b42c Merge "Remove DTSUBSCRIBELINK cached HTML compat" 2024-04-17 15:22:33 +00:00
Bartosz Dziewoński cf792094bb TopicSubscriptionsPager: Fix exception when no subscriptions
Bug: T362507
Change-Id: I569fb2ae017edc9d8e49910faff85e8c9301077d
2024-04-15 21:03:55 +02:00
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 e2309342ce Remove DTSUBSCRIBELINK cached HTML compat
Follow-up to Ie3348671c486de5bbd9f286772a8d145e3609bd5.

Change-Id: Ia4cd4f5d26e95b3557cae6f80f49fa5da138890f
2024-03-26 23:39:53 +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
Bartosz Dziewoński cc9524e268 Remove workaround for T357812
Change-Id: I1aa3172c5656a79171351d0122f83b680adea739
2024-03-16 19:57:19 +00: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