Commit graph

414 commits

Author SHA1 Message Date
Bartosz Dziewoński fda08f7b54 Remove the new topic tool hint
This temporary message has been shown for long enough.

This mostly reverts:
* d0eec56f6d
* f24a73a05a
* bd40523843

Bug: T322495
Change-Id: Ic1762e170547fba8b5fda225eff21e515ace512d
2023-05-24 20:15:49 +02:00
jenkins-bot 8e94616fad Merge "Update warning about logged-out editing for temp user creation" 2023-05-16 17:51:45 +00:00
Bartosz Dziewoński 8b2e0d7be9 Update warning about logged-out editing for temp user creation
Depends-On: I2ea656a8a1704a495f1a94fede1a8829ba7325a1
Depends-On: I84ce108b4d46b4e19fad032382f8b69a1b0065d5
Bug: T332432
Change-Id: I8487d7d249c66bf3c3c60120f490a6ba72745aac
2023-05-16 18:57:46 +02:00
jenkins-bot 518d6c406c Merge "Add maint script to opt out active users from the new topic tool" 2023-05-16 16:05:52 +00:00
David Lynch 71d2e76d7f Update a/b test code for visual enhancements a/b test
Strip it out from applying to logged out users and make the test work
for multiple features

Bug: T333715
Change-Id: Id15a8a99c2ea8e6fc14fc83baf2ed6ebaaf754c8
2023-05-08 01:30:21 -05:00
Bartosz Dziewoński 2321e645f4 Add maint script to opt out active users from the new topic tool
Opt out users who are active (according to Special:ActiveUsers)
and have at least 100 edits, unless they have already opted in
by enabling the beta feature.

To run the script, use the new run.php wrapper:

  php maintenance/run.php MediaWiki.Extension.DiscussionTools.Maintenance.NewTopicOptOutActiveUsers

Bug: T317375
Change-Id: I953c4c9d00a60b00a621049b119ba96c9682004d
2023-05-05 18:51:38 +02:00
jenkins-bot d74fff198d Merge "Add an API version of Special:FindComment" 2023-04-26 18:02:09 +00:00
Ed Sanders 0be67d3f20 Add an API version of Special:FindComment
Bug: T333375
Change-Id: I02f032b0a36d384b9ac9e397106eb30d325421d8
2023-04-26 17:09:15 +01:00
jenkins-bot 12abc51940 Merge "resources: Use core's manageForeignResources script now we can" 2023-04-25 19:09:28 +00:00
James D. Forrester a8a645e9e4 resources: Use core's manageForeignResources script now we can
Depends-On: I5df95ea4799d0efce60b58a35cb916c8e0f555b0
Change-Id: If6b323a46ec8eff1b908b4524b48527913a6f343
2023-04-25 14:46:16 -04:00
gerritbot 605b6f96bf Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: I2381ae00735c6924eba97141e3194ee111f75cc7
2023-04-25 09:53:18 +00: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 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 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
jenkins-bot 24185a1471 Merge "styles: Replace 'mediawiki.ui/variables' call with skin variables" 2023-04-04 15:12:11 +00:00
Volker E 03d1ea70ab styles: Replace 'mediawiki.ui/variables' call with skin variables
Replacing 'mediawiki.ui/variables.less' @import with
new skin-aware 'mediawiki.skin.variables.less' standard.
Also
- replacing several static values with new Codex design token featuring
  skin variables – `background-color` `color`, `border-*`, `box-shadow`.
- removing skin overrides like `.skin-monobook`, they are now covered
  by the skin variables.
Patch requires MediaWiki core version >= v1.41.0.

Bug: T332541
Co-Authored-by: Volker E. <volker.e@wikimedia.org>
Change-Id: I36c7a0f5ed06c3eccd792b19b6a1972663f20df6
2023-04-04 01:14:24 -07: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
David Lynch fed37fcc82 preloadparams on other platforms supports numbered indexes
Change-Id: I4f1f5e8758007ab95e342ad5429c909f495d8deb
2023-04-01 22:49:06 +02: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
jenkins-bot d08871fdae Merge "Centralize EditAttemptStep logging code in WikimediaEvents" 2023-03-27 15:30:43 +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
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
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
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
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
Bartosz Dziewoński 48fd5e09bb Remove 'DiscussionToolsLegacyHeadingMarkup' config option
Bug: T314714
Change-Id: Ie268d1282f81c81c5a18d5858dcf7023515101b7
2023-01-22 19:24:36 +01:00
Ed Sanders 5c5073b5ba Enable visual enhancements on all talk namespaces
Bug: T325417
Change-Id: I099a7d03f059f08595dec43ff0205fd5ba765885
2023-01-11 18:35:51 +00:00
David Lynch d3a44b1092 Language code for zh-yue wiki is just yue
Bug: T323537
Change-Id: Ia6563b15ac92afc79eb3507bdd69bc4bf3000e33
2022-12-22 14:04:49 -06: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
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 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 af6f6e6149 Merge "Disable "Share feedback..." links by default" 2022-11-08 22:04:08 +00:00
Ed Sanders b4eb7fc9ad Disable "Share feedback..." links by default
Will still be enabled on WMF wikis for now.

Bug: T322494
Change-Id: Ic0b79fdf459d4949d7604f5a213cb1851ca30901
2022-11-08 21:58:39 +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 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 0d24c4881a Merge "Revert "Add config to separate out visualenhancements on mobile"" 2022-11-02 09:17:53 +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 2b0d2deb4a ABtest for mobile, logged in users
Bug: T320993
Change-Id: I46597f2846811c52cbaba1a1db31bff575a41246
2022-10-31 16:23:46 -05:00
jenkins-bot ffb5dd6a86 Merge "Add accesskey "s" to the "Reply" / "Add topic" button" 2022-10-26 16:32:58 +00:00
jenkins-bot 38bc9bba60 Merge "Separate out mobile init from controller.js" 2022-10-20 21:57:35 +00:00
Bartosz Dziewoński 5ed1c4a482 Add accesskey "s" to the "Reply" / "Add topic" button
Add brackets around the existing shortcut key labels, so that they
don't look quite so out-of-place next to the automatically added
accesskey label.

Bug: T278249
Change-Id: Icc0df5ba036080807ea0eb215f5526c93da78ef1
2022-10-20 22:58:25 +02:00
Ed Sanders d0cd0e57a1 Separate out mobile init from controller.js
Change-Id: I2dfafc1d816c5cae97fd51bc11de9aefbdd73ee8
2022-10-14 17:38:19 +01:00
Bartosz Dziewoński f9903401a6 Autogenerate list of files for JS test module instead of maintaining it by hand
Depends-On: I223f63aab132444833aad7d7c162b27c9e93991c
Change-Id: Ib869b66d9f9155163ad9e0475e5e8a69dac9f55a
2022-10-12 22:41:41 +00:00
Bartosz Dziewoński a46af344dc Use RevisionLookup methods instead of ApiParsoidTrait methods
Part of my secret plan to delete ApiParsoidTrait.

* Inject RevisionLookup into ApiVisualEditor
* Use RevisionLookup::getRevisionById instead of ApiParsoidTrait::getValidRevision
* Use RevisionLookup::getRevisionByTitle instead of ApiParsoidTrait::getLatestRevision
* Use standard MediaWiki error messages

Change-Id: I7244ee4916fb011fad5faa1d9f837e83f6ac2dc1
2022-10-09 18:17:32 +00:00
David Lynch d5161bf086 Add config to separate out visualenhancements on mobile
Follow-up to d0126ce6de which made them
default-on for all mobile. These two taken together mean that the
mobile visual enhancement features now *only* depend on this config,
rather than on whether the individual features are enabled on desktop.

Bug: T318871
Change-Id: If767753e6d33f19bbc540d4e74273e478198388c
2022-09-28 17:12:48 -05:00
Bartosz Dziewoński 2679fa3b04 Replace VisualEditor ParsoidHelper with ParsoidClient
Depends-On: I21c4a8cd86f8d085e75a601ed6d2509dedd75d42
Change-Id: I9533d7c05047c2d873c8c6ee5944df965e3b379d
2022-09-19 18:00:14 +02:00
Bartosz Dziewoński dc07d802a9 Inject services into API classes
This replaces the remaining uses of MediaWikiServices::getInstance()
in API classes.

Change-Id: I5f602a7e7b5a21a7d40023571018604528ea8edb
2022-09-03 00:23:41 +02:00
Ed Sanders 40bd58859e Prefix browser title while replying/starting a new topic
We already do this while editing so that users can quickly see which
tabs they are actively working on.

This extends the functionality to the reply and new topic tools.

Bug: T262066
Change-Id: Iae662ad26072617aad71e519bb6c3cbb19ef1246
2022-08-25 16:12:54 +01:00
Ed Sanders 0e95e45e88 Add space after namespace on talk pages
Bug: T313636
Change-Id: I481e885b54a1aeb9dd69a08dc614ab5f4f94b41e
2022-08-18 16:02:27 +01:00
jenkins-bot 5d965ad9db Merge "Add config option to enable/disable permalinks backend" 2022-08-17 03:25:30 +00:00
Bartosz Dziewoński e6fff19e7e Prevent using the reply tool together with Convenient Discussions gadget
Parts of the implementation copied from the Popups extension.

Bug: T298909
Change-Id: I2c42c6ff1c5d84da9333f8f74a4aec5c8fea704b
2022-08-17 01:40:43 +02:00
Bartosz Dziewoński 4ffebd80f2 Add config option to enable/disable permalinks backend
From in-person code review with Amir: using tableExists() is a bad
idea, because the table might not consistently exists on all replicas.
It's better to have a config option despite the inconvenience.

Bug: T315353
Change-Id: I728759634c454c0dcbdc4603c15cab60415c7c03
2022-08-16 18:38:45 +00:00
Bartosz Dziewoński 0024a94ba7 Store permalink data, implement Special:FindComment/GoToComment
Depends-On: I90656cc74bb1cb1f2f3c82ad51cfb164cb8a4a4b
Bug: T296801
Change-Id: I84187b303aa10a242c872088403f808df3d1f940
2022-08-11 01:19:47 +02:00
Bartosz Dziewoński 69848614f8 Bring back [reply] links in old revisions without breaking preview
It turns out that using the "enableSectionEditLinks" post-cache
transform option was not a good idea, as it is also set when viewing
old revisions and in some other cases.

However, in the pre-cache parsing, we have access to getIsPreview(),
which is exactly what we want. I think we can safely do this there.
We were already using that prior to 2bc76dabd7.

Bug: T314260
Change-Id: I7f769db48eff9fa434483902a4b5ac2f5fc96b3d
2022-08-02 21:57:44 +02:00
Ed Sanders 980b2c38bc Make reply links into buttons when visual enhancements enabled
Bug: T255560
Bug: T309904
Change-Id: I3932f576086a43df89ff97a1b3dafdc27c54f71c
2022-08-01 20:59:53 +02:00
Bartosz Dziewoński a0bcd6eb05 Add more tests cases using the "tracked" template
Change-Id: I7327cd2140fb8622f65ab8f96daba99f16f9e3af
2022-07-31 03:56:33 +02:00
jenkins-bot 6e57e3ba78 Merge "Show a "Return to reply/new topic" button when widget is scrolled off the screen" 2022-07-18 16:09:54 +00:00
Ed Sanders 2c2e57fd47 Show a "Return to reply/new topic" button when widget is scrolled off the screen
Bug: T310967
Change-Id: I3d1626162eb5c66ac35560792a81ce09455e86a8
2022-07-18 13:20:12 +01:00
Bartosz Dziewoński 2bc76dabd7 Enable transformations in preview mode
We remove the [reply] and [subscribe] links when they should not be
visible (controlled by 'enableSectionEditLinks' option, which is
disabled when previewing).

Bug: T309423
Change-Id: Ie0d3fba2c4d166daac3ea2e117a246c9584284ca
2022-07-07 23:37:56 +01:00
Ed Sanders 639fabf647 Pass useskin/mobileformat when previewing/refreshing page contents
These are required to render content correctly on mobile.

Change-Id: I421e1f172e208c4bf9d50eee68f1b0220a78dfbe
2022-06-27 17:15:28 +01:00
Ed Sanders b1be63469b Only enable visual enhancements in specific namespaces
Change-Id: I91643d3f07a9ee6f03a18f8e2787ab9cb61bc41d
2022-06-24 16:15:07 +01:00
Bartosz Dziewoński 109a50cb34 Truncate timestamps in comment IDs / names
For comments posted on or after 2022-07-12 (configurable), use a
shorter format, identical to the timestamps MediaWiki uses in URLs.

Changing the format for already existing comments would involve
difficult migrations, therefore we elect not to do it.

Bug: T304595
Change-Id: I387051a6a3a1d84cfae45c3e1516db870cc8b977
2022-06-24 00:49:58 +02:00
Ed Sanders da64c43ccc Show thread metadata in section headers
Bug: T269950
Change-Id: Ifa47ddcbccf288be0bbecd5961eab7c5122aab7b
2022-06-23 17:17:09 +01:00
Ed Sanders af5b9a9b46 ReplyWidgetVisual: Pass in memory-wrapped store to VE
We switched to our memory-wrapped store everywhere outside the
VE surface, but not in the VE surface itself.

Change the way we construct MemoryStorage objects so that they can
be constructed from a specific mw.SafeStorage instance.

Ensure MemoryStorage's cache is populated with initial storage object
data, and that the cache is copied over when we create derivative
objectes.

Bug: T310438
Change-Id: I652428f114dc5169195887cb8ca719ae196bb76f
2022-06-17 14:05:54 +01:00
Bartosz Dziewoński e0f231b892 Add preference for offering new topic tool when creating new talk pages
Depends-On: I46a8eaf331e86de0c8c94f0f60bdc4b5be6dd83a
Bug: T297990
Change-Id: Iaf6677affe5d0b7f6047bce55c0a575286c8e676
2022-06-06 17:09:50 +00:00
Ed Sanders 15551ac453 Enable autotopicsub by default
Bug: T297966
Depends-On: Ic898673464c66832221d5343441070b1638f6050
Change-Id: Ica8b1ffaf134f77c7110645fd69748acb0c2d668
2022-05-25 03:56:40 +02:00
David Lynch b6f554a945 Ready A/B test code for topic subscriptions
Topic subscription test is going to be all logged in users only, no
transitory enrollment conditions, so we can remove the anonymous user
handling and DB writes.

Bug: T302515
Bug: T304030
Change-Id: I5e57bb9b7958576f3a04373748331a86f4626fb5
2022-05-19 01:09:40 -05:00
Ed Sanders cf3e7c49d8 Redesign "new comments" warning
Bug: T300560
Change-Id: I5abf22b5a11c2639392a3d571c987ed5afaac2d6
2022-05-12 18:02:32 +01:00
Bartosz Dziewoński a31f022ba5 Remove limit on the number of topic subscriptions per user
We added the limit out of abundance of caution, because we were not
sure how the table is going to grow. We can see now that it's growing
slowly and reasonably.

Bug: T294881
Change-Id: I5da444c5d070926452e96ddbbe728b9e0375e466
2022-04-14 17:52:23 +00:00
Bartosz Dziewoński cf255f28bf Replace mediawiki.Uri with native URL (or polyfill)
Depends-On: I7c4f9b6449a4317d68f4923fb4f198181bbfe800
Depends-On: I04464c17369ffb0dd4e7c33d2bd4db7b2d050bf4
Bug: T305010
Change-Id: I02da91010304af35f0b1f2bd4d65a84d51f29930
2022-04-08 00:35:37 +02:00
jenkins-bot 6948f0b3f3 Merge "Move cache expiry update from ParserAfterParse to ParserAfterTidy" 2022-03-15 21:44:44 +00:00
C. Scott Ananian 8e09b67c0d Move cache expiry update from ParserAfterParse to ParserAfterTidy
The ParserAfterParse hook will likely be deprecated, as Parsoid can't
properly support it as-is.  Luckily, DiscussionTools isn't doing
anything in ParserAfterParse that couldn't happen in the (supported)
ParserAfterTidy hook.

Bug: T303630
Change-Id: If72feb1e277c09f4ea0df339f2dd097a9b329d71
2022-03-15 12:19:57 -04:00
Bartosz Dziewoński 01b253c5b6 Don't allow the root node to be treated like a comment frame
Also fix a bug where headings would be ignored while checking for
comment frames. See task for detailed explanation.

Bug: T303396
Change-Id: I6495826b4b050ea80680e0798ac6ab4497a7c09e
2022-03-10 17:45:08 +00:00
jenkins-bot bd43c2a139 Merge "Add test case for fake headings using wikitext ;" 2022-03-10 00:17:49 +00:00
jenkins-bot 4b2f9ede8e Merge "Use MessageWidget's showClose option" 2022-03-08 22:41:39 +00:00
Ed Sanders 6869112aad Use MessageWidget's showClose option
Change-Id: I81292bd84ce6feefdb852f6a636109f68e55291d
2022-03-08 01:25:22 +00:00
Ed Sanders da49448f43 Poll for new comments in the section you are replying in
Bug: T300504
Change-Id: I3a887ab2f5260bb4893a3d680103c9d8ec767f45
2022-03-04 00:40:29 +00:00
jenkins-bot 3c91a800ed Merge "Improve detecting already signed comments" 2022-03-02 14:14:13 +00:00
jenkins-bot 094b77b4bb Merge "Handle reply/topic preview entirely server-side" 2022-03-02 14:13:59 +00:00
Ed Sanders 1032db4878 Move (auto) topic subscription initialisation to separate file
Bug: T302805
Change-Id: Ia901cba731233719dd1d5916eb5211a551d34091
2022-03-01 21:27:08 +00:00
Ed Sanders ecbe75c453 Move highlighting methods to separate file
Bug: T302805
Change-Id: Ie4a8ea3f351015ab5bb4b817ef997cf6d77428da
2022-03-01 14:29:10 +00:00
Ed Sanders b6136c9a58 Rename highlighter to debughighlighter
Change-Id: I8c3873fb345fee3687efb1632f3eae36c030f9cf
2022-03-01 14:20:18 +00:00
jenkins-bot 0dc293fc20 Merge "Warn when target comments in a link can't be found" 2022-02-28 23:24:15 +00:00
Bartosz Dziewoński be74938855 Warn when target comments in a link can't be found
Links are generated to:
* Single comments, by a user or by a notification
* Potentially multiple comments (new comments since T),
  usually just by notifications.

If in either case no comments are found to highlight, warn the
user so they get some visual feedback that the notification worked
as expected, but that the comment was just deleted since.

Bug: T301602
Change-Id: I090c904481cf6f3e9f964fa43b10001e75b0bc90
2022-02-28 21:58:59 +00:00
jenkins-bot 542da89530 Merge "Don't detect comments within references" 2022-02-28 16:47:21 +00:00
Ed Sanders b4f10c5638 Mobile config: Always enable reply/newtopic tools on mobile, disable subscriptions
Bug: T302326
Change-Id: I64ffc904046f7d9d2fa651c086876add35061e0a
2022-02-22 23:24:28 +01:00
Bartosz Dziewoński 0ecc8a4c05 Improve detecting already signed comments
Previously, we required a signature at the end of the comment.
This was a pretty rough heuristic that did not correctly handle
many comments that we would consider entirely properly signed
in CommentParser (e.g. comments wrapped in formatting like
<small>…</small>, comments with a post-scriptum or in parentheses,
or comments generated by various templates).

Now we process the user input using the same code that adds reply
links, and only add a signature when we detect that there really
isn't a signature (including template-generated), or if the signature
is in the wrong place and would result in the reply link showing up
in the wrong place as well (not at the end of the comment).

Bug: T278442
Bug: T268558
Bug: T278355
Bug: T291421
Bug: T282983
Change-Id: I46b6110af328ebdf93b7dfc2bd941e04391a1599
2022-02-21 21:21:26 +00:00
Bartosz Dziewoński 4244418e56 Don't detect comments within references
Bug: T301213
Change-Id: Ifd5198651c8ed0ce53379fb5e35938089cd54a09
2022-02-21 19:57:44 +00:00
Bartosz Dziewoński 1d43a024f9 Handle reply/topic preview entirely server-side
We were rendering the preview in a completely different way from how
we would add the real reply, and the results would be different
sometimes, particularly for multi-line comments with messed-up markup.

Render it server-side instead, in a very similar way to real replies
(generating a DOM list node and transforming it through Parsoid),
although without the whole context of the page to improve performance.

We can remove a lot of client-side code that was used solely for this.

This will allow the preview to accurately display the signatures when
we change how they are added (T278442), without us having to implement
those changes again from scratch for the preview.

Change-Id: I53341f4d4075c25b67ec3b3032bff9b8a880dcd3
2022-02-21 17:42:28 +01:00
Bartosz Dziewoński 8e44b43df0 Split off ThreadItemSet from CommentParser
Goal:
-----
Finishing the work from Iadb7757debe000025e52770ca51ebcf24ca8ee66
by changing CommentParser::parse() to return a data object, instead of
the whole parser.

Changes:
--------
ThreadItemSet.php:
ThreadItemSet.js:
* New data class to access the results of parsing a discussion. Most
  methods and properties are moved from CommentParser with no changes.

CommentParser.php:
Parser.js:
* parse() returns a new ThreadItemSet.
* Remove methods moved to ThreadItemSet.
* Placeholder headings are generated slightly differently, as we process
  things in a different order.
* Grouping threads and computing IDs/names is no longer lazy. We always
  needed IDs/names anyway.
* computeId() explicitly uses a ThreadItemSet to check the existing IDs
  when de-duplicating.

controller.js:
* Move the code for turning some nodes annotated by CommentFormatter
  into a ThreadItemSet (previously a Parser) from controller#init to
  ThreadItemSet.static.newFromAnnotatedNodes, and rewrite it to handle
  assigning parents/replies and recalculating legacy IDs more nicely.
* mw.dt.pageThreads is now a ThreadItemSet.

Change-Id: I49bfe019aa460651447fd383f73eafa9d7180a92
2022-02-21 16:22:32 +00:00
Bartosz Dziewoński 99b5de8038 Split Data class into ResourceLoaderData and LanguageData
The Data class contained utilities for two unrelated purposes.
Split each half to a separate class.

Notably, this improves the signature of the getLocalData() function.

Change-Id: Icde615fb9d483fee1f352c34909b37f8ffde8081
2022-02-19 19:37:34 +01:00
Bartosz Dziewoński 62766e846c Add test case for fake headings using wikitext ;
Bug: T265964
Change-Id: I31db66dc011b3d13dd46426f15286c5b3b5c9254
2022-02-12 00:35:02 +01:00
Ed Sanders aa03dc971e Add discussiontoolscompare API
For two given revisions, this API tells us which comments have
been added and which have been removed.

Can be used to highlight new comments, or check if the page
has been updated since we first loaded it.

Bug: T281624
Bug: T300504
Change-Id: Ia4d95ffe3b7cf2317cd8e7c0f034e09f64777ef3
2022-02-08 15:53:27 +00:00
Ed Sanders 025130fcd2 Don't prompt to reload the page if the reply widget is open
Only show the reload prompt if the 'disappeared' error is detected
when the reply widget is loading. Don't show it if we failed
to save, as it suggests you will not lose content if you reload.

Change-Id: I106f274e180dc97b540d729e31aae575c43f29f0
2022-02-07 22:45:35 +00:00