Commit graph

1005 commits

Author SHA1 Message Date
Bartosz Dziewoński 0d21df43dc Allow maintenance script to work even when DiscussionToolsEnablePermalinksBackend is off
Bug: T334258
Change-Id: I40e09b2f8561eeac1744bbbc48e3973e519bd9ea
2023-04-14 19:36:18 +02:00
Bartosz Dziewoński f681188d57 Update talk_page_edit logging for IP masking
Bug: T332437
Bug: T332432
Change-Id: I6ffd6b48e683a82065da35241110fd32888d2c4e
2023-04-11 21:52:05 +02:00
Bartosz Dziewoński 316e741868 Support topic subscriptions when JavaScript is disabled
Unsubscribing was already available from Special:TopicSubscriptions
when JavaScript is disabled.

* Add links to subscribe/unsubscribe in CommentFormatter
* Update links in skin navigation
* Add support for subscribing in the actions

Bug: T321431
Change-Id: If3c4bf7df309d0d98237c3b7b9c129cc2f72cda3
2023-04-10 21:30:19 +02:00
jenkins-bot 4496b24771 Merge "SpecialDiscussionToolsDebug: Fix duplicated subthreads" 2023-04-08 02:46:50 +00:00
jenkins-bot 2b5c98c42c Merge "Add optional tracking category for comments in the lede section (before first heading)" 2023-04-08 01:15:37 +00:00
Bartosz Dziewoński 7543fb9c3e SpecialDiscussionToolsDebug: Fix duplicated subthreads
Change-Id: Iff517ab1f6a7f1f42705a0bf7f2e98d07f3022f9
2023-04-07 21:54:26 +02:00
Bartosz Dziewoński 6a7d949703 Remove integration with removed MobileFrontend talk page tools
* Remove the hook we used to disable that feature
* Remove CSS that only applied when it was enabled
* Update code comments that referred to it

Bug: T319145
Change-Id: If21a04f6a087289d8249a786f7c991e5e12c9bed
2023-04-04 17:17:49 +02:00
Ed Sanders 92f5cfd821 Support suppressing comment detection in pages or sections
This can be done within sections using CSS:
* mw-notalk

Or at a page level using a magic word:
* __NOTALK__

"notalk" suppresses all comment detection, treating the content as
not containing any comments even if there are signatures present.

Bug: T295553
Bug: T249293
Change-Id: Ic1d7294bafcf7071e16838e70684ecadd7bc6fd3
2023-04-03 18:36:34 +02:00
Ed Sanders 856b90fa3e Support hiding reply links in archived pages or sections
This can be done within sections using CSS:
* mw-archivedtalk

Or at a page level using a magic word:
* __ARCHIVEDTALK__

"archivedtalk" still detects the comments, but disables features
as appropriate for an archived conversion, i.e. the reply tool.

Bug: T295553
Bug: T249293
Change-Id: Ic47693e9a2f53f92563ccdd50203fb55c12d0493
2023-04-03 18:34:57 +02:00
Ed Sanders e66327746a New topics notifications: Only highlight comments in new threads
Bug: T333476
Change-Id: I3f29c4b5a9be916d25415db18f50bd8efe6532af
2023-03-30 18:42:28 +00:00
Ed Sanders 2fcc505d50 Parser: Store timestamp ranges
Change-Id: Ifcbe22011f11f4374f38b7aa346da5a96cac968c
2023-03-28 23:51:17 +00:00
Bartosz Dziewoński 8e570a742b Don't ship data for skipped tests to JS test code
In local testing, this reduces the amount of data loaded by
Special:JavaScriptTest from 27 MB to 20 MB.

Change-Id: I37f0f677751031cc965d1921a62871154bbe9201
2023-03-29 01:48:36 +02:00
jenkins-bot 454e15e8aa Merge "List "Topic subscriptions" under "Account management" on Special:SpecialPages" 2023-03-28 11:05:43 +00:00
Bartosz Dziewoński 18689b370a Add optional tracking category for comments in the lede section (before first heading)
The tracking category is disabled by default and has to be
enabled by overriding the localisation message
'MediaWiki:Discussiontools-comments-before-first-heading-category'.

Bug: T324139
Change-Id: I6e4818e9421f76aec814444b2da9f5d8585c75fd
2023-03-28 01:32:04 +02:00
jenkins-bot 9e51f11b8c Merge "Add new topics subscription button in Minerva" 2023-03-27 23:04:55 +00:00
Ed Sanders e6a255215f Add new topics subscription button in Minerva
Bug: T332730
Change-Id: Ib6915319eeae4aa32c875decd51e7fd8db4dbd16
2023-03-27 23:28:38 +01:00
Bartosz Dziewoński 9f5692cf85 List "Topic subscriptions" under "Account management" on Special:SpecialPages
Bug: T333242
Depends-On: Ieba1631ca3c0562b784aa07d2b26c418448e70a1
Change-Id: I98f67216936846005f2fe1482b18c863da7e0bc7
2023-03-27 21:50:24 +00:00
jenkins-bot d08871fdae Merge "Centralize EditAttemptStep logging code in WikimediaEvents" 2023-03-27 15:30:43 +00:00
Bartosz Dziewoński c0cb0bb24d Add a limit to queries on SpecialFindComment etc.
Some mass messages appear on hundreds or thousands of pages and it's
not good to try to list them all.

Change-Id: Ib903d67ba4fd9d85790ef4271933991b9b6f3834
2023-03-26 10:29:39 +00:00
jenkins-bot 98f37c5e9e Merge "Add Special:DiscussionToolsDebug" 2023-03-24 16:25:04 +00:00
jenkins-bot 7106233d59 Merge "Only show the mobile add topic button on view pages" 2023-03-24 00:37:12 +00:00
Bartosz Dziewoński 8d2304b3ed Add Special:DiscussionToolsDebug
It demonstrates how the DiscussionTools extension recognizes
the threads and comments present on a page, to help in debugging
or understanding its behavior.

Co-Authored-By: Ed Sanders <esanders@wikimedia.org>
Change-Id: Idbc90bd8d7742615178331889daae5f94a007fcc
2023-03-23 20:43:31 +01:00
David Lynch 0cf9c41b18 Only show the mobile add topic button on view pages
Bug: T332897
Change-Id: Id63c391a286356d9007f9a7a0b6eec75747ee6c3
2023-03-23 10:19:10 -05:00
Bartosz Dziewoński 6bf128cf2d Use setExtensionData() instead of marker comments where possible (3/3)
We started using marker comments (HTML comments with special content
inserted into the page) for the reply buttons back in the day, because
we needed to indicate their location in the HTML. Later we used the
same idea for things which aren't actually tied to a specific location
in the HTML, such as boolean data like __DTEMPTYTALKPAGE__. There is a
better way to do this.

This commit stop writing the HTML comments, which are no longer used,
and cleans up the tests.

Bug: T328980
Change-Id: I37541356830945cc9abcc79d4c445ff6f2449759
(cherry picked from commit ab40ef62c0)
2023-03-21 00:13:01 +01:00
Ed Sanders 80dd6e2d7c Add new topic subscription button to page actions
Bug: T263821
Change-Id: Iab7f7d5fd1f7c229c2e0cda9369676cfd401a24e
2023-03-20 14:51:10 +00:00
Ed Sanders 2bae1864bd New topic notifications
Bug: T263821
Change-Id: Ied465e732122a1ee39ab4510f73aca11ef556c35
2023-03-20 14:41:53 +00:00
Ed Sanders 4367595bfd EventDispatcher: Generate dt-added-topic events
Change-Id: I98b67e016995866558274809743fa21ed23ee063
2023-03-20 14:41:21 +00:00
Bartosz Dziewoński dcecf76ff1 Centralize EditAttemptStep logging code in WikimediaEvents
PHP logging code is not moved.

* Use the new mw.track() handlers from WikimediaEvents
* Ensure that 'integration' and 'editor_interface' are set on init
  events, since they're not hard-coded in the handler any more
* Remove the setting of 'editingStatsId' tracking parameter,
  now happens in WikimediaEvents (by way of VE ArticleTargetSaver)
* Remove code connecting ve.track to mw.track, now happens in VE

This must be merged together with WikimediaEvents change
Iace4d53a972396ca5b8713000570cc47c9986034 (but we can't use
Depends-On, because CI requires code here to be removed first).

Bug: T332438
Change-Id: I0ef0a96aafdf89a4ebe32131a85b18c25744bb2c
2023-03-18 13:26:10 +00:00
jenkins-bot f05699af82 Merge "ThreadItem: Add display names to getAuthorsBelow" 2023-03-16 19:36:48 +00:00
jenkins-bot 95019f563d Merge "CommentParser: Output display name if different to username" 2023-03-16 19:36:46 +00:00
jenkins-bot 2185ac1ca3 Merge "Allow visualenhancements on pages with __NEWSECTIONLINK__" 2023-03-15 20:24:19 +00:00
jenkins-bot 49d3d44ce3 Merge "Use setExtensionData() instead of marker comments where possible (2/3)" 2023-03-15 15:49:38 +00:00
Ed Sanders 12e8d1a17d Allow visualenhancements on pages with __NEWSECTIONLINK__
Exclude the main namespace unless it allows signatures.

Allow this feature to be disabled via config so
we can do a slow rollout.

Bug: T331635
Change-Id: If46bff5620c5245d5b82653ee96282532fd00c28
2023-03-13 15:32:23 +00:00
jenkins-bot 663170fb2d Merge "Support '&preload=...' etc. in new topic tool when '&dtpreload=1' is set" 2023-03-08 20:55:32 +00:00
jenkins-bot 2750f2cc53 Merge "Use the new method of getting database object" 2023-02-27 18:24:43 +00:00
jenkins-bot 45fe4c3bec Merge "Disable on LiquidThreads pages" 2023-02-24 00:11:35 +00:00
Ed Sanders 79a62f539d ThreadItem: Add display names to getAuthorsBelow
Change-Id: I4195f982d7071fea0d0334908535639a11cdcae9
2023-02-23 23:03:35 +00:00
Ed Sanders b82af45735 CommentParser: Output display name if different to username
The only normalisation we apply for comparison is lowercasing.

Change-Id: Id3d57c2066429fcedc7dcc091e74ed46e17060f1
2023-02-23 23:03:32 +00:00
Amir Sarabadani a1ee2d6daf Use the new method of getting database object
Bug: T326274
Change-Id: I40c6efee0d13ebb6f345ac9f13d243d730b146b9
2023-02-23 12:57:16 +01:00
Bartosz Dziewoński 5af3e90fec Support '&preload=...' etc. in new topic tool when '&dtpreload=1' is set
To avoid affecting existing preload forms, the new topic tool is only
used when the 'dtpreload' query parameter is also set.

Bug: T269310
Change-Id: I4ee024cc4760542790319f302f42b1b2389ac897
2023-02-15 16:39:38 +01:00
Bartosz Dziewoński e6681772da Avoid unneeded queries in isAvailableForTitle()
Don't check the 'newsectionlink' property if we don't need it.

Also improve comments.

Change-Id: I50a84ba5e21ffd22859e770329522babf6e729c8
2023-02-14 16:53:48 +00:00
Bartosz Dziewoński 445b8caca0 persistRevisionThreadItems: Avoid listing non-discussion pages
Bug: T329627
Change-Id: I52a9f5dfa583d8dc2e0a315844a2a40e538f6a8c
2023-02-14 17:53:27 +01:00
Bartosz Dziewoński 93f8d338c8 Disable on LiquidThreads pages
Bug: T329423
Change-Id: Id8995e4d35083b740806499c545d1b308a9a1722
2023-02-14 00:50:07 +01:00
Bartosz Dziewoński 5d3d3cf687 Use setExtensionData() instead of marker comments where possible (2/3)
We started using marker comments (HTML comments with special content
inserted into the page) for the reply buttons back in the day, because
we needed to indicate their location in the HTML. Later we used the
same idea for things which aren't actually tied to a specific location
in the HTML, such as boolean data like __DTEMPTYTALKPAGE__. There is a
better way to do this.

This commit starts reading from ParserOutput::getExtensionData(),
which was generated by the previous commit, and should be present
in all cached ParserOutput objects by the time we merge this.

Bug: T328980
Change-Id: I9f7a907836b86f25567fd4b352464d62d76e20e4
(cherry picked from commit 0ac420ecbc)
2023-02-11 21:16:03 -06:00
DLynch fb08abe062 Revert "Use setExtensionData() instead of marker comments where possible (2/3)"
This reverts commit 0ac420ecbc.

Reason for revert: this was supposed to be merged later; revert it now and reapply in a bit

Change-Id: I33fb07856152c2401b3a071c143f27f1e9753287
2023-02-12 02:57:31 +00:00
Bartosz Dziewoński 0ac420ecbc Use setExtensionData() instead of marker comments where possible (2/3)
We started using marker comments (HTML comments with special content
inserted into the page) for the reply buttons back in the day, because
we needed to indicate their location in the HTML. Later we used the
same idea for things which aren't actually tied to a specific location
in the HTML, such as boolean data like __DTEMPTYTALKPAGE__. There is a
better way to do this.

This commit starts reading from ParserOutput::getExtensionData(),
which was generated by the previous commit, and should be present
in all cached ParserOutput objects by the time we merge this.

Bug: T328980
Change-Id: I4bf81ef3fd904f4d920d0756370c9bfa0a10a774
2023-02-11 19:33:20 +00:00
Bartosz Dziewoński 8fb467896f Use setExtensionData() instead of marker comments where possible (1/3)
We started using marker comments (HTML comments with special content
inserted into the page) for the reply buttons back in the day, because
we needed to indicate their location in the HTML. Later we used the
same idea for things which aren't actually tied to a specific location
in the HTML, such as boolean data like __DTEMPTYTALKPAGE__. There is a
better way to do this.

This commit starts writing data to ParserOutput::setExtensionData(),
which will be used in a later commit to be merged separately to avoid
issues with cached ParserOutput objects.

Bug: T328980
Change-Id: Ieb7bc3f83a402f9ebb096ed63336c77073bd2e7c
2023-02-11 20:19:55 +01:00
Bartosz Dziewoński fce317ace4 Move TOC metadata generation to a post-processing step
Instead of generating the TOC HTML additions immediately, store
the data we need using ParserOutput::setExtensionData(), and use
the OutputPageParserOutput hook to fetch it and generate the HTML.

We check that the stored data is present before using it to avoid
issues with cached ParserOutput objects.

Bug: T328122
Change-Id: I7d4988cd568f10b7995a4d744e0ec6e7ce081b0e
2023-02-07 02:39:11 +01:00
Ed Sanders 15a8074002 Special:TopicSubscriptions: Perform unsubscribe asynchronously
Bug: T327662
Change-Id: Ib7f5cf8b075f44ac06c0a014aa1e200ccda8fe26
2023-02-04 14:30:14 +00:00
jenkins-bot c5ac63f921 Merge "Add comments about unwrapping Parsoid sections" 2023-02-02 17:57:53 +00:00
jenkins-bot b95faa7978 Merge "Remove __DTLATESTCOMMENTPAGE__ comment from output" 2023-02-02 17:52:23 +00:00
Ed Sanders 3c04944a86 Remove __DTLATESTCOMMENTPAGE__ comment from output
Other DT markers are removed because we return the body text, but
in this case we return subtitle text to be inserted elsewhere.

Instead pass $text by reference so it can be modified directly.

Change-Id: I9fe4194681cd3737661dca3c8a16e30a6001bd73
2023-02-02 12:51:11 +00:00
Bartosz Dziewoński 3624d89c8b Don't add custom attributes in unwrapParsoidSections()
This code was unnecessarily copied from VE. It's not needed for
anything in this extension, and it causes the headings to be treated
as modified by selser, which in turn causes dirty diffs.

Bug: T328268
Change-Id: Ibdbed430f2ff28d0ea2e67644075c1621d9fae53
2023-01-31 01:32:02 +01:00
Bartosz Dziewoński 5ad0a7bfcb Add comments about unwrapping Parsoid sections
Follow-up to c9deff179f.

Change-Id: Ib32442020749103012ec508d870d40b7b96f05a0
2023-01-27 17:07:56 +01:00
C. Scott Ananian 086ce6550f Don't rely on ParserOutput::getTOCHTML() to determine if ToC is present
ParserOutput::getTOCHTML() is being deprecated, and all skins are now
generating the TOC from the TOCData returned by
ParserOutput::getTOCData().  The SHOW_TOC flag was introduced in core
to determine if the TOC should be shown, but Vector-2022 *may* begin to
use other heuristics to determine whether to show the TOC (T315862).
We're conservatively going to process the TOC as long as there is
TOC present to process.

Bug: T328072
Change-Id: I38b439c6752157dbee9b09c9f5443a740dbaabf4
2023-01-27 09:58:47 +00:00
Bartosz Dziewoński c9deff179f ApiDiscussionToolsEdit: Unwrap Parsoid sections before parsing
Otherwise, when a transclusion covers a section boundary, both whole
sections are considered to be transcluded.

We already use this method everywhere else (by way of
HookUtils::parseRevisionParsoidHtml), and VisualEditor also applies
the same transformation (mw.libs.ve.unwrapParsoidSections) before
opening the page for editing.

Bug: T327704
Change-Id: I9d8288e2740d816edb9cbc01d7e5642d52c610d3
2023-01-26 19:26:14 +00:00
jenkins-bot 1f342306b4 Merge "Update exception handling for new code conventions" 2023-01-23 15:32:40 +00:00
jenkins-bot b857a61c75 Merge "SpecialFindComment: Use new FormSpecialPage helpers" 2023-01-23 15:27:59 +00:00
Bartosz Dziewoński 48fd5e09bb Remove 'DiscussionToolsLegacyHeadingMarkup' config option
Bug: T314714
Change-Id: Ie268d1282f81c81c5a18d5858dcf7023515101b7
2023-01-22 19:24:36 +01:00
Bartosz Dziewoński af68c835bb Update exception handling for new code conventions
Change code to match the documented consensus formed on T321683:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Exception_handling

* Do not directly throw Exception, Error or MWException
* Document checked exceptions with @throws
* Do not document unchecked exceptions

For this extension, I think it makes sense to consider DOMException an
unchecked exception too (in addition to the usual LogicException and
RuntimeException).

Depends-On: Id07e301c3f20afa135e5469ee234a27354485652
Depends-On: I869af06896b9757af18488b916211c5a41a8c563
Depends-On: I42d9b7465d1406a22ef1b3f6d8de426c60c90e2c
Change-Id: Ic9d9efd031a87fa5a93143f714f0adb20f0dd956
2023-01-22 18:17:11 +00:00
jenkins-bot b7405bb006 Merge "Update generating DiscussionTools TOC additions after parser changes" 2023-01-19 21:37:04 +00:00
Bartosz Dziewoński 228ad6f457 Update generating DiscussionTools TOC additions after parser changes
Depends-On: I8329864535f0b1dd5f9163868a08d6cb1ffcb78f
Depends-On: I1b267d23cf49d147c5379b914531303744481b68
Bug: T326677
Change-Id: Id59b946f4a3618a75dfaaef8a0043423b768b21c
2023-01-19 13:29:16 -05:00
jenkins-bot 8facd83609 Merge "Improve handling for comment separators" 2023-01-17 11:48:43 +00:00
jenkins-bot 8b8dba6124 Merge "Test ServiceWiring.php" 2023-01-17 05:53:07 +00:00
Umherirrender ecac4c3bd1 LanguageData: Use special page alias with spaces
The alias stored in the language files is with underscores,
but the value is compared in CommentParser against text with spaces

Affected languages: bjn, hu, id, jv, kaa, tl, tpi, vi, war

Bug: T327021
Change-Id: I8626627d10a240973e631e24508937a9eee9fb14
2023-01-16 22:27:23 +01:00
daniel 47118f901a Reduce parsoid PC writes to randomized sample
We need to be careful about flooding the parser cache with parsoid
content. For this reason, we currently only write to PC for a certain
sample of edits. This logic is implemented in core in
ParsoidHandler::allowParserCacheWrite and controlled by the
TemporaryParsoidHandlerParserCacheWriteRatio setting.

DiscussionTools triggers parsoid PC writes when handling the
RevisionDataUpdates hook, so it should use the same sampling.

Change-Id: Ic33f57b10ae53f431a3c3484c4853e88bf80f47a
2023-01-13 20:52:05 +00:00
Dreamy Jazz 68ae9555f1 Test ServiceWiring.php
Test ServiceWiring.php using tests copied from CentralAuth. Because
phpunit does not support marking a file as covered, the ServiceWiring
file is ignored for code coverage as the tests fully cover the file.

Change-Id: I7da8d74fec84a5aa9c77bc0678ad8f55b550893a
2023-01-13 12:01:38 +00:00
jenkins-bot 63e6f270f3 Merge "Enable visual enhancements on all talk namespaces" 2023-01-12 00:25:07 +00:00
Ed Sanders 5c5073b5ba Enable visual enhancements on all talk namespaces
Bug: T325417
Change-Id: I099a7d03f059f08595dec43ff0205fd5ba765885
2023-01-11 18:35:51 +00:00
jenkins-bot 029d8d6d66 Merge "Track callers of parseRevisionParsoidHtml." 2023-01-11 18:23:50 +00:00
daniel b15aecc68c Track callers of parseRevisionParsoidHtml.
We are seeing a lot of parser cache writes coming from
parseRevisionParsoidHtml. We should find out what is causing them.

Change-Id: I25440e0d759e19cc9769404beb6911c64d37d3e3
2023-01-11 19:01:45 +01:00
Bartosz Dziewoński f7104b350f SpecialFindComment: Use new FormSpecialPage helpers
Depends-On: I14c0ebc017aa7387d03dac1ee0021d52d8ba3d0e
Change-Id: I023a701091afa06ef545e18f672e95ea6ee9b575
2023-01-11 04:30:29 +00:00
jenkins-bot d81886c5ce Merge "Enable collapsible content in mobile talk page lede content" 2023-01-10 16:37:11 +00:00
Bartosz Dziewoński 3a9997d6ea Improve handling for comment separators
* Detect comment separators at the end of comments too
* Consider TemplateStyles associated with ignored templates

This unexpectedly improves a lot of cases other than T313097 too,
mostly where <br> or {{outdent}} was used within a paragraph:
splitting comments that were previously jumbled together, or restoring
content that was previously ignored for apps / notifications.

Bug: T313097
Change-Id: I9b2ef6b760f2ffd97141ad7000f70919aeab7803
2023-01-10 01:59:52 +00:00
Bartosz Dziewoński af7097f02f Enable collapsible content in mobile talk page lede content
Bug: T323639
Change-Id: I3cfc8e7337172b44156a7f3bed9ff134c0851475
2023-01-03 18:16:15 +00:00
Tim Starling ef7213a3d3 Clean up ApiDiscussionToolsPageInfo hack
Treat non-talk pages as empty ContentThreadItemSet objects, instead of
returning early from execute().

Exclude non-talk pages even if only the rev_id is specified.

If both rev_id and title are specified, use the title from the
database.

Bug: T325477
Bug: T325598
Change-Id: I3947ac94bb7c9a3d24b73c95f0df2cf847c955f2
2022-12-21 00:57:34 +00:00
Amir Sarabadani 00f5ba5db4 Emergency: discussiontoolspageinfo return empty response in non-talk ns
Bug: T325477
Change-Id: Ia7c8cca8051c800646c0f403065589f682d1ff17
2022-12-19 08:57:43 +01:00
jenkins-bot 05e717f3ef Merge "VisualEnhancements: in some languages put an arrow by the reply button" 2022-12-13 19:47:12 +00:00
daniel a6a12730fc Don't write to parser cache from maintenance script
The parser cache for parsoid output isn't yet ready for full load.
Don't flood it when running batch operations.

Change-Id: I77f3de30b0500f0e5c593f4d31dceef7720f848e
2022-12-13 16:26:03 +00:00
David Lynch c706562ce9 VisualEnhancements: in some languages put an arrow by the reply button
New config: DiscussionTools_visualenhancements_reply_icon_languages

Config is set up with a provide_default merge strategy so we can remove
items from it quickly if need be.

Bug: T323537
Change-Id: Ib748897a2162bb233000f7364e30b268932f4c4a
2022-12-13 00:11:08 -06:00
Ed Sanders c2dc05b085 Add 'collapsible-headings-collapsed' body class
Used by MobileFrontend in I78cfb22fbe7d to prevent sections from
auto-expanding.

Bug: T321618
Bug: T322628
Change-Id: I6dafd5b9cb170bfa57f185849db6450162173399
2022-12-07 16:51:22 +00:00
daniel 683edf3947 Track parsoid render reason.
Call ParserOptions::setRenderReason to allow us to track why we render
and in particular, why we write to the parser cache.

Change-Id: If42f802f4cf2da39b06cbb8a30c4dc7d9a663001
2022-12-05 20:54:55 +01:00
jenkins-bot 984f804f17 Merge "Don't collapse the lede section when it has comments" 2022-12-05 19:04:37 +00:00
jenkins-bot 8a6bc91f46 Merge "Consider MediaWiki:Talkpageheader message when adding "Learn more" button" 2022-12-05 19:04:35 +00:00
Bartosz Dziewoński a2a06d0316 Reverse default sorting on Special:TopicSubscriptions
Bug: T324245
Change-Id: I87c43bda9a40fdf66c3f4f2d8bc66e211107a557
2022-12-01 22:18:18 +01:00
David Lynch 51ed8a21f6 Avoid error building threaditemshtml if there's an empty final section
If the final content on a page is a heading, there would be an error as
we tried to access nextSibling on a non-existent node.

Also tidies up the case where there's an empty section that's not the
final section. It would have `othercontent` set to an empty string,
which was pointless -- the empty `replies` field is sufficient.

Bug: T321317
Change-Id: Ia58e97214e715c1f6b02c2e045d13f2df7393b80
2022-12-01 11:44:28 -06:00
Bartosz Dziewoński b4475801fd Don't collapse the lede section when it has comments
Bug: T324139
Change-Id: I14e1dae0fef4177f5a6a223bc9b663e99c9f741c
2022-11-30 20:25:22 +01:00
Bartosz Dziewoński e72f58ca78 Remove some redundant PHPDoc comments
Inspired by this Wikitech-l discussion:
https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/NWXPNHRNLEVXHSWX33H473OAWQP6CDOA/

To keep this simple for now, I am only removing redundant PHPDoc
comments on constructors, and only when all the documentation for
parameters completely duplicates type hints.

More could be done, but that can happen later when we have better
tooling. Redundant comments on constructors that take a dozen services
are by far the most annoying for me and I want them gone now.

Change-Id: I86cbf7d6e48035cfa06f780c8fb1b02e68709a0c
2022-11-29 18:47:18 +00:00
Bartosz Dziewoński 74fbe19838 Consider MediaWiki:Talkpageheader message when adding "Learn more" button
We also need to move the code to the other hook to avoid adding it twice now.

Bug: T324046
Change-Id: I186d15f6e6537b47b019c9707d7ae8ef080f4ae2
2022-11-29 18:46:40 +00:00
Bartosz Dziewoński be012ced04 Only match article path until first '?' when parsing links
Bug: T324028
Change-Id: I7aca1a8f20695b9ecd3f63f2d0a3f5684616655e
2022-11-29 17:16:03 +00:00
jenkins-bot ea54a8facc Merge "Use 'BeforePageDisplay' instead of 'OutputPageBeforeHTML' for once-per-page things" 2022-11-28 15:23:52 +00:00
Bartosz Dziewoński 8452f94cf9 Use 'BeforePageDisplay' instead of 'OutputPageBeforeHTML' for once-per-page things
Also fix a CSS selector to handle content added in multiple
'OutputPageBeforeHTML' hook calls.

Bug: T323376
Bug: T323833
Change-Id: I480d9bf544d61f0cb7bfd04cadfbf053e7e1b70e
2022-11-25 16:12:16 +00:00
jenkins-bot 36af2d1002 Merge "Allow replying to some comments with accidental complex transclusions" 2022-11-24 14:00:45 +00:00
jenkins-bot eb9631164d Merge "Place replies outside transclusions, disallow replying to transcluded comments" 2022-11-24 14:00:40 +00:00
Bartosz Dziewoński 7dd4855979 Fix Phan failure due to core changes in Action
Caused by I8188172aeb7ec775eeb2060a1e163112e9e5ed66.

Change-Id: Ieafc280c76b20e4efbe23cf3e2b193a4a6490b50
2022-11-23 11:27:54 +00:00
Bartosz Dziewoński 3042148bfe Dedupe ApiDiscussionToolsTrait::parseRevision and HookUtils::parseRevisionParsoidHtml
After recent changes (I101c1e84739a2ac1f562f2f7bdc4b8f53d9f3b23 and
Ifbde590ccb6bf3203a2f664cb0d8a73b8d507b78) these methods became
basically the same.

Change-Id: Iedc201e798a5a34713296b20b97ae6cc8b991b66
2022-11-21 21:01:19 +00:00
Derick Alangi 672ca86016 ApiDiscussionToolsTrait: PageInfo & Compare don't need HTML for editing
ApiDiscussionToolsPageInfo and ApiDiscussionToolsCompare in direct parsoid
or VRS modes tries to fetch HTML using VisualEditor thus stashing the
HTML gotten which we don't want, we only need it for viewing in these cases.

This seems like something that was/is already happening in RESTBase. So for
APIs in DiscussionTools that need the HTML for viewing, just get it from
parser cache and not stash it.

Bug: T323357
Change-Id: I101c1e84739a2ac1f562f2f7bdc4b8f53d9f3b23
2022-11-21 16:29:13 +01:00
Bartosz Dziewoński 9601fde487 HookUtils::parseRevisionParsoidHtml doesn't need HTML for editing
Bug: T323357
Change-Id: Ifbde590ccb6bf3203a2f664cb0d8a73b8d507b78
2022-11-21 13:37:16 +01:00
Bartosz Dziewoński e0be640c35 Don't add lede button if mobile DiscussionTools not enabled
Bug: T323341
Change-Id: I60d93a3e72918d303a45b2a75f4fa549aea8d917
2022-11-18 15:55:54 +01:00
David Lynch 714830f615 Don't run OutputPageBeforeHTML for the talkpageheader
Ideally this would just not run the hook for any interface messages, but
that condition isn't obviously available.

Bug: T316175
Change-Id: Ibd354eb7a0fb7a316dcbf09e64b80f2d9b4008c8
2022-11-17 21:15:51 -06:00
Bartosz Dziewoński 4cebf20e76 CommentFormatter: Fix condition for lede button to consider table of contents
(Also fix some related CSS that was accidentally moved in
Ie5198e902ec3fa7a7eba56cef6c6f0ef71ef7314)

Bug: T323241
Change-Id: I1fa67965a1b6b827c500a9de63f5b5295bee840d
2022-11-16 22:18:11 +01:00
jenkins-bot 1a35468eb3 Merge "CommentFormatter: Fix condition for lede button to consider new wrappers" 2022-11-16 21:09:04 +00:00
jenkins-bot 954dc520b7 Merge "Make "Add topic" button sticky" 2022-11-16 19:06:30 +00:00
Ed Sanders b132522fa9 Make "Add topic" button sticky
Bug: T316175
Change-Id: Ie5198e902ec3fa7a7eba56cef6c6f0ef71ef7314
2022-11-16 12:23:34 +00:00
Bartosz Dziewoński 0432eaf1e3 CommentFormatter: Fix condition for lede button to consider new wrappers
Bug: T323171
Change-Id: I3125f98e57bf410f19ece07b8376c92ae619d0ea
2022-11-15 23:39:45 +01:00
Bartosz Dziewoński 3a0b05f564 Allow replying to some comments with accidental complex transclusions
When a comment almost exactly matches the range of an
accidental complex transclusion consisting only of
pages from the 'Template' namespace and wikitext fragments,
I think we can safely allow replying to the comment.

Even if this turns out to be incorrect in some cases,
the failure will be more graceful after the changes in T313100:
instead of potentially duplicating contents from a template,
the worst case now is that the reply will appear in the wrong
place (at the end of the transclusion).

Bug: T313093
Change-Id: Ie8da09d74a652d893fd8c3e2435ef6cb70fad64a
2022-11-14 19:17:36 +01:00
Bartosz Dziewoński 469b7720af Place replies outside transclusions, disallow replying to transcluded comments
Bug: T313100
Change-Id: I3993c96ec8d3d0add33d779860d158327985107d
2022-11-14 19:17:18 +01:00
jenkins-bot 0655cdbf56 Merge "Move visualenhancements metadata and some buttons outside of <h2>" 2022-11-14 15:29:12 +00:00
Bartosz Dziewoński 08e1073f58 ThreadItemStore: Handle race conditions when finding/inserting outside of transaction
Bug: T322701
Change-Id: Icea63dd562c1812a372f3a947ba1244e72d07a16
2022-11-10 23:33:24 +00:00
Bartosz Dziewoński 04cfffe323 Move visualenhancements metadata and some buttons outside of <h2>
We wrap a `<div>` tag around the `<h2>`, and move some elements there.
The markup is inspired by and compatible with my proposal for T13555.

The "ext-discussiontools-init-section" class is moved to the `<div>`.

A small patch is needed in MobileFrontend to preserve the section
collapsing functionality: I11bff21e81046898ca63f3f432797129fa70ad88.

The following elements are now outside of `<h2>`:
* Metadata bar
* Subscribe button
* Ellipsis menu (only shown on mobile)

The following elements are sadly still inside of `<h2>`:
* Subscribe links (only shown on desktop)
* Section edit links from MediaWiki core
Trying to move them mucks up the CSS too much. I hope we can resolve
this later as a part of the work on T13555.

Depends-On: I11bff21e81046898ca63f3f432797129fa70ad88
Bug: T314714
Change-Id: I0bbdcfa02c334858737855349d7a35746de1d8f2
2022-11-10 23:35:40 +01:00
Ed Sanders 79521f89cf Add button to reveal lede section on mobile
Bug: T312309
Depends-On: I9c3035c9dbe7545a05efb2286dffe0145d3557b4
Change-Id: I9d74914ddbcc9def74e85106a68574a807b0b731
2022-11-10 22:10:04 +00:00
jenkins-bot d1911e4f11 Merge "ThreadItemStore: Fix setting parent IDs when parent already existed" 2022-11-08 19:01:42 +00:00
jenkins-bot c83bad9de8 Merge "Embed pageThread JSON in jsConfigVars instead of infusing HTML" 2022-11-08 18:59:48 +00:00
jenkins-bot c0e757c716 Merge "ABtest for mobile, logged out users" 2022-11-08 18:41:38 +00:00
jenkins-bot 811c32c518 Merge "ABtest for mobile, logged in users" 2022-11-08 18:41:23 +00:00
Ed Sanders a00131a18f Embed pageThread JSON in jsConfigVars instead of infusing HTML
Bug: T322651
Depends-On: I86d461756398780dc24949013f35b7730a481052
Change-Id: I85ee8e6ed6eba97b94f4e4c415fbc5286c234cce
2022-11-08 16:20:39 +00:00
jenkins-bot 0251155359 Merge "Topic subscription feature is unavailable if Echo is not installed" 2022-11-08 03:11:14 +00:00
Bartosz Dziewoński 759e6b757a ThreadItemStore: Fix setting parent IDs when parent already existed
Bug: T322599
Change-Id: I697de586fb3c1b1901f434f6fbef501cec3164df
2022-11-08 01:38:41 +01:00
Ed Sanders d6160c76fa Topic subscription feature is unavailable if Echo is not installed
Bug: T322498
Change-Id: I072e9363fceb4beae820b7742dec4249b4f58905
2022-11-07 12:28:45 +00:00
jenkins-bot 98285f3b27 Merge "ThreadItemStore: Update existing rows if possible rather than insert+delete" 2022-11-03 14:12:49 +00:00
Bartosz Dziewoński c4c455c550 ThreadItemStore: Update existing rows if possible rather than insert+delete
Bug: T321121
Change-Id: I678b093aef95febb33cf4b0140b0625ef3241779
2022-11-03 00:53:19 +01:00
jenkins-bot 140939b3dd Merge "Avoid unsafe wrapping of Message::parse() into paragraph" 2022-11-02 18:37:29 +00:00
jenkins-bot 0d24c4881a Merge "Revert "Add config to separate out visualenhancements on mobile"" 2022-11-02 09:17:53 +00:00
Timo Tijhof 18e523281c Avoid unsafe wrapping of Message::parse() into paragraph
Bug: T322173
Change-Id: I8405a33129ab17edcb7a02440146684170f1c0a7
2022-11-02 00:19:46 +00:00
Bartosz Dziewoński c53b44d1bc Revert "Add config to separate out visualenhancements on mobile"
No longer needed.

This reverts commit d5161bf086.

Bug: T318868
Change-Id: I909266903271cecba050d171a3ec66ef0a12b8a9
2022-11-01 21:09:37 +00:00
David Lynch 9021a45966 ABtest for mobile, logged out users
Bug: T320993
Change-Id: I3530c540ec20f8806abcd7010b4d4933d1b53cfc
2022-10-31 16:23:59 -05:00
David Lynch 2b0d2deb4a ABtest for mobile, logged in users
Bug: T320993
Change-Id: I46597f2846811c52cbaba1a1db31bff575a41246
2022-10-31 16:23:46 -05:00
Bartosz Dziewoński 433e57394c Use PHP 7.4 property types
Change-Id: I788db64f0c0c00894d77256b7f016d44eda4bbb1
2022-10-28 21:56:38 +02:00
jenkins-bot da907eb610 Merge "Don't apply topic containers to table-of-contents heading" 2022-10-26 16:30:28 +00:00
jenkins-bot c9dadbfe7d Merge "Remove support for <span class="mw-headline-number"> in headings" 2022-10-26 16:29:41 +00:00
jenkins-bot d55b8f8d2f Merge "Don't insert comment markers inside <figure>" 2022-10-26 16:28:37 +00:00
Bartosz Dziewoński 9cbb0a8c60 Don't apply topic containers to table-of-contents heading
Change-Id: I3abbf7907907f6280e6b58bcf4307c0ce3b1898e
2022-10-25 18:59:25 +00:00
Bartosz Dziewoński c6cd20f682 Remove support for <span class="mw-headline-number"> in headings
This feature has been removed from MediaWiki in change
Ic9ed88f419419cf4cc5cc32010539eea8b76314b.

Change-Id: If11b33589f47eab614f5129b38e80d0f3cafa083
2022-10-25 18:59:05 +00:00
jenkins-bot 2e28320eb2 Merge "ThreadItemStore: Fix updates for identical revision timestamps" 2022-10-24 23:57:07 +00:00
jenkins-bot f85f7fde10 Merge "ThreadItemStore: Remove long comment no one is ever going to read" 2022-10-24 16:22:24 +00:00
jenkins-bot 0db489b3e7 Merge "EventDispatcher: Remove reference to $wgWMESchemaEditAttemptStepOversample" 2022-10-24 12:48:27 +00:00
jenkins-bot 341b180a66 Merge "Don't insert reply tool outside <section> on mobile" 2022-10-22 02:39:44 +00:00
Bartosz Dziewoński d2df103803 Don't insert reply tool outside <section> on mobile
Bug: T319148
Change-Id: I7db0ef1980f4997b77593f3d43d35886ecd8a4ae
2022-10-21 01:20:13 +02:00
Bartosz Dziewoński 8c9a7c451e Retry without RESTBase when the page/revision seems to be missing
Bug: T315688
Change-Id: I2ec0fa20cc1ee36fc521441ac00c5515dc66a37c
2022-10-20 23:06:16 +00:00
Bartosz Dziewoński 33f4006713 ThreadItemStore: Fix updates for identical revision timestamps
Use revision IDs to break the tie, consistently with MediaWiki (see
RevisionStore::getRelativeRevision) instead of assuming that the
revision we're processing now is somehow both older *and* newer than
the other one (the mind boggles how that ever made sense to me).

Change-Id: I9f1a07124301a36be68578d908353b72f0442c00
2022-10-20 02:37:47 +02:00
Bartosz Dziewoński 91aeaabe83 ThreadItemStore: Remove long comment no one is ever going to read
I should have just put that in a commit message rather than source code.

Change-Id: Ia5c06c91c21b0b5da1ed578369825a3870c48833
2022-10-20 01:49:19 +02:00
jenkins-bot 3c53a489cf Merge "CommentFormatter: Always add the overflow menu" 2022-10-18 16:16:42 +00:00
jenkins-bot 66780457e4 Merge "Add 'wpTextbox1' to parameters that disable new topic tool" 2022-10-18 15:47:21 +00:00
jenkins-bot a9191c49b8 Merge "Ship HTML test files for JS using 'packageFiles' instead of 'templates'" 2022-10-14 16:53:38 +00:00
jenkins-bot bf1b17d34a Merge "Autogenerate list of files for JS test module instead of maintaining it by hand" 2022-10-14 16:53:36 +00:00
jenkins-bot f09d91a29c Merge "ThreadItemStore: Move some work in insertThreadItems() outside transactions" 2022-10-14 16:36:45 +00:00
jenkins-bot d7cf6adb0a Merge "Log page/revision IDs when the page/revision seems to be missing" 2022-10-14 16:34:45 +00:00
jenkins-bot 19e64cd8ee Merge "Use ParsoidOutputAccess when RESTBase is not set up (WMF private wikis)" 2022-10-14 16:34:15 +00:00
jenkins-bot a8bf67c4e9 Merge "Fix '?dtenable=1' on mobile" 2022-10-13 00:00:01 +00:00
Ed Sanders cdad0cc260 Fix '?dtenable=1' on mobile
isFeatureEnabledForOutput already checks if the mobile flag is enabled,
but it also respects the dtenable=1 override.

Change-Id: I95035281bf301b22c1a9ef4c06ec54cdd0cbc85c
2022-10-12 23:53:12 +00:00