Commit graph

884 commits

Author SHA1 Message Date
Ed Sanders e6a255215f Add new topics subscription button in Minerva
Bug: T332730
Change-Id: Ib6915319eeae4aa32c875decd51e7fd8db4dbd16
2023-03-27 23:28:38 +01:00
jenkins-bot 7106233d59 Merge "Only show the mobile add topic button on view pages" 2023-03-24 00:37:12 +00: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
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