Commit graph

524 commits

Author SHA1 Message Date
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
jenkins-bot 6a23be0bb5 Merge "Move ApiDiscussionTools to ApiDiscussionToolsPageInfo" 2022-02-07 20:43:26 +00:00
Ed Sanders 7cad692afa Move ApiDiscussionTools to ApiDiscussionToolsPageInfo
Also remove 'paction' param, and instead make 'transcludedFrom' a
property of the result object.

Change-Id: I0a289f6d71e4708afff0b52066b1ed6faf76b9ae
2022-02-07 16:50:02 +00:00
jenkins-bot c86029397e Merge "Remove DiscussionToolsEnableTopicSubscriptionBackend config" 2022-02-05 00:49:17 +00:00
Ed Sanders 0b42aea276 CommentParser: Cache variables in getUsernameFromLink
Change-Id: I625e6ded3badd75a7a658c8d000576d0d165a18b
2022-02-04 19:35:18 +00:00
Ed Sanders 8ad1df7dc8 CommentParser: Name parts of return value from findSignature
Change-Id: I3a5ad36df0afdedc0aa9a15e5d83c5426b03b790
2022-02-04 19:34:18 +00:00
Ed Sanders 6d655dee0a Remove DiscussionToolsEnableTopicSubscriptionBackend config
This is now deployed on all wikis, and going forward I don't think
we need to make this configurable.

Change-Id: I231976267ba6cdfeec622efaa15983a84c330649
2022-02-04 18:22:10 +00:00
Bartosz Dziewoński 165ca9b847 Improve CommentModifier::addReply() API for re-use and testing
Goal: To be able to re-use or test the transformations we previously
  performed in addWikitextReply() / addHtmlReply(), without requiring
  a Comment object or adding the result as a reply.

Change-Id: I040c4be9b6b9bddba661f30fd0566f8850673074
2022-02-03 21:12:48 +00:00
Bartosz Dziewoński 15f0867b75 Limit where whitespaceParsoidHack() is used
* We don't need it anywhere in JS, since we're not sending that HTML
  to Parsoid.
* We only need it on the nodes directly containing our reply lines in
  PHP, not all over the place.

Change-Id: I0a04388225f32654dda2f599442cd27a303b5d0a
2022-01-29 22:42:46 +00:00
Bartosz Dziewoński 6572e108f9 Remove empty lines in visual mode in some more cases
After switching from source mode to visual mode, there will be some
Parsoid-generated white space between block nodes, which remains when
the reply is posted in visual mode.

Follow-up to e064f43499.

Bug: T300439
Change-Id: Ia5d2c06f0a4125e9f148eddd3235f95138c9d37f
2022-01-29 22:42:41 +00:00
jenkins-bot 0b52563b53 Merge "One more tweak for comparing comment ranges to transclusion/DOM ranges" 2022-01-24 23:37:07 +00:00
jenkins-bot 4679dd27b3 Merge "Use class list everywhere for adding/checking CSS classes" 2022-01-24 23:37:05 +00:00
Bartosz Dziewoński 110a59200f One more tweak for comparing comment ranges to transclusion/DOM ranges
When we encounter a node that doesn't represent comment contents, e.g.:
* a [reply] link we inserted (T297034#7641334)
* an {{outdent}} template (see changed test case)

…we should ignore it together with its descendants (like in
Parser#nextInterestingLeafNode), instead of processing descendants
and possibly detecting comment contents in them.

Follow-up to 8de940b587,
72b9c2c6f5.

Bug: T297034
Change-Id: Ib2fa40c5fa389572b0e88ef558728fa06e3621b0
2022-01-24 17:42:18 +00:00
Bartosz Dziewoński f15693eefa Use class list everywhere for adding/checking CSS classes
In PHP, use DOMCompat::getClassList(), provided by Parsoid.
In JS, use `.classList`, available in all supported browsers.

This may fix some bugs where we were incorrectly checking for exactly
one class. The change in isOurGeneratedNode() is needed for
Ib2fa40c5fa389572b0e88ef558728fa06e3621b0.

Change-Id: Ia28d31678fd3d617b69280c4b7857755300fa515
2022-01-24 18:40:00 +01:00
Bartosz Dziewoński 5919e4e371 Don't try to parse section titles as wikitext in subscription notifs
Bug: T299572
Depends-On: Idb3a87fd18330f90a8cdc1276994d54288e17b28
Change-Id: I3b58f337bb2ea1f5255fc0a41dbd7a5ad8c433db
2022-01-21 00:12:58 +01:00
Bartosz Dziewoński d2405cc11c Simplify handling of sections in bundled notification links
This code previously ensured that the fragment identifier linking
to a section was only included if all events had the same section.
It doesn't actually seem worth the effort, since we handle scrolling
to the highlighted comments client-side anyway.

And the links were not quite correct, because we didn't parse and
strip the section title as expected by built-in Echo events. Just
use Echo's code for this.

Depends-On: Idb3a87fd18330f90a8cdc1276994d54288e17b28
Change-Id: Icae0d3654dd02109337ff8737b16f55bbd514f43
2022-01-21 00:06:36 +01:00
Bartosz Dziewoński 8f937eb9da Prevent assertion failure caused by empty headings
Follow-up to 8de940b587.
See also 8b426c7e5c.

Bug: T299583
Change-Id: Ibd2c459330cfc7664bd36d7840209779450d72d4
2022-01-20 18:56:32 +00:00
jenkins-bot 5181d099ab Merge "PreferenceHooks: Don't call saveSettings in LocalUserCreated" 2022-01-12 21:58:04 +00:00
jenkins-bot 3699158e81 Merge "Handle selflinks by returning the current page's title" 2022-01-12 21:46:35 +00:00
jenkins-bot 7f329ca9a2 Merge "Enable wikis to customize the syntax used for replies" 2022-01-12 21:32:49 +00:00
Ed Sanders f80ff74fc6 Handle selflinks by returning the current page's title
Bug: T287818
Change-Id: I67f10ac9976581279d1e6a477e90d55875ebab20
2022-01-12 21:18:04 +00:00
Ed Sanders 34011b7a07 Parser: Pass in title of page being parsed
Will be used to parse selflinks in the future.

Change-Id: I2bc29d1c5c69cb6309f582f162f9af7d96ce8913
2022-01-12 21:17:59 +00:00
Bartosz Dziewoński 7b1053300a Enable wikis to customize the syntax used for replies
The following values for configuration variables are supported:
$wgDiscussionToolsReplyIndentation = 'invisible'; (default)
$wgDiscussionToolsReplyIndentation = 'bullet';

Bug: T259864
Change-Id: Icefad79630adc6ed35687498614e6a03ede1451b
2022-01-12 20:54:04 +00:00
Kosta Harlan f9f1884ac3 PreferenceHooks: Don't call saveSettings in LocalUserCreated
$user->saveSettings() happens in AuthManager after the LocalUserCreated
hook finishes running.

Bug: T199393
Change-Id: Ic661dbe1ffaa3a5438373a33c10ad3053662d932
2022-01-12 19:21:17 +01:00
jenkins-bot f189c985da Merge "Fix placeholder headings causing exceptions in getTranscludedFrom()" 2022-01-12 17:18:55 +00:00
jenkins-bot 6c5461d858 Merge "Treat user talk subpages like normal talk pages in empty state text" 2022-01-12 17:04:21 +00:00
jenkins-bot 6b31c89159 Merge "Ignore the beta feature setting when enrolling in the A/B test" 2022-01-12 01:59:04 +00:00
jenkins-bot ecd649f6e2 Merge "Allow logged out users to be enrolled in the A/B test" 2022-01-12 01:58:50 +00:00
Bartosz Dziewoński 8b426c7e5c Fix placeholder headings causing exceptions in getTranscludedFrom()
Follow-up to 8de940b587.

Change-Id: Iddf045105fac6ab8cdaa933fd2abcf6dbbd37d42
2022-01-11 23:24:45 +00:00
Ed Sanders 272b6595f5 Docs: Illustrate range overlaps in comment
Change-Id: If6f5d83719b8d078cd13327c0b9cbaef03f87508
2022-01-11 17:28:25 +00:00
Bartosz Dziewoński 72b9c2c6f5 Ignore some invisible nodes when looking for comment frames
Reimplement getFullyCoveredSiblings() using compareRanges(), which
checks basically the same thing, but works better and I like it more.

Bug: T297034
Change-Id: I33dc1d088bdee984064315290e378bfbfa830b10
2022-01-11 17:01:53 +00:00
Bartosz Dziewoński 8de940b587 Improve detecting transcluded comments again
Previously: 569db3603c (2020-06).

Unfortunately we've found cases where the previous implementation
doesn't work correctly, resulting in comments being added to the wrong
pages or page corruption.

Bug: T289873
Bug: T298051
Change-Id: Id867b3005ebc46906d6df852a525fcaec9e6b19b
2022-01-11 16:07:44 +00:00
Bartosz Dziewoński 492dbd7847 Fix inserting comment start markers when they're outside of any wrappers
Comment boundaries are stored as a DOM parent node plus a child index.
Because of that, inserting anything into the DOM before a comment –
such as another comment's start/end markers – would cause us to insert
subsequent comments' markers into the wrong places.

This issue didn't affect many pages, because usually any parent node
would have just one comment in it. Only pages with comment boundaries
outside of any wrappers (directly inside the root node) were broken.

Just process the list in reverse to fix this.

Bug: T298096
Change-Id: Iccffc36b71e9fcf3d72c4db2b9459d39042f7a2d
2022-01-11 16:07:37 +00:00
David Lynch 893290d4b4 Ignore the beta feature setting when enrolling in the A/B test
We realized that any change made to Special:Preferences will set the
beta preference even if they didn't visit the beta tab, so we can't
actually tell if manual intent was involved. As such, we'll enroll
people regardless of their beta setting -- they can disable the feature
through regular preferences if they want, and that'll be respected.

Bug: T291307
Change-Id: I8c1cbf51060012e8e68af252da84944dfcc681d8
2022-01-10 18:10:50 -06:00
David Lynch 2f1e2f80e0 Allow logged out users to be enrolled in the A/B test
For logged out users we store their test state and an anonymous
identifier in local storage. So long as the test is enabled, we include
these in any logging that occurs.

This is done entirely client-side, to avoid any cache issues caused by
state depending on cookies from PHP for logged out users.

Bug: T291307
Change-Id: Ib39e2f2146cdfdac9df5690ee3de75718f0f2731
2022-01-10 18:10:50 -06:00
Bartosz Dziewoński d0dd6b3f73 Treat user talk subpages like normal talk pages in empty state text
Bug: T298454
Change-Id: I0b95f87fe934dcb7d233265b0a41956ed8f3c143
2022-01-03 16:36:08 +01:00
Alexander Vorwerk 397dc2cea5 Replace usages of deprecated wfWikiID()
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().

Bug: T298059
Change-Id: Ie878a5479b7427e9ffab7d7f92ee2802997e3161
2021-12-21 01:45:54 +00:00
Umherirrender d32dcfbb3c Use ParserOptions::newFromAnon instead of ParserOptions::newCanonical
ParserOptions::newCanonical is deprecated.

Change-Id: I26667c9102c37d962ceaa81c082566819b503744
2021-12-18 20:15:02 +01:00
jenkins-bot fb16305135 Merge "Show a hint on legacy interface when arriving from new topic tool hint" 2021-12-17 17:30:39 +00:00
jenkins-bot e568c62f85 Merge "Show a hint on the new topic tool to explain that it's new" 2021-12-17 17:30:37 +00:00
jenkins-bot be07ec8cfc Merge "Add Range::compareBoundaryPoints" 2021-12-17 16:48:04 +00:00
jenkins-bot c4fb0f7046 Merge "Change auto topic subs to re-subscribe you if you unsubscribed" 2021-12-17 15:32:40 +00:00
jenkins-bot 0f32a760b4 Merge "Move some helpers from CommentParser to CommentUtils" 2021-12-17 01:02:26 +00:00
Bartosz Dziewoński 12aa136f54 Add Range::compareBoundaryPoints
Change-Id: I7b8b9f196bb1ed95304d8b7755d51246c4515bc9
2021-12-17 00:55:00 +00:00
Ed Sanders 4a88be8084 Move user subscription limit to config
This makes it easier to change going forward, and
configurable on 3rd party wikis.

Bug: T294881
Change-Id: I9e5343cab42cb00ed6b62cf5adf9e02b072481f1
2021-12-16 21:07:40 +01:00
Bartosz Dziewoński d0eec56f6d Show a hint on legacy interface when arriving from new topic tool hint
Bug: T293962
Change-Id: I56823efb4e58839b3f121ff23d576984b86e4e81
2021-12-16 17:43:23 +00:00
David Lynch f24a73a05a Show a hint on the new topic tool to explain that it's new
This shows to users who are logged in and have more than 500 edits

Bug: T293962
Change-Id: Ic47fa897c6a4f43c27d4cfd5571e34f8acb01eb8
2021-12-16 16:01:38 +01:00
Ed Sanders d2443f7785 Rename DiscussionToolsAutoTopicSubWhere to DiscussionToolsAutoTopicSubEditor
Better describes that we are checking the editor used to make
the edit, rather than descibing some virtual "location".

Change options to 'discussiontoolsapi' and 'any'.

Change-Id: I3024517e70ed61c738e4bf46a2ac7b58c975d98a
2021-12-15 16:24:35 +00:00
jenkins-bot f731b7a575 Merge "Update abtest bucketing for newtopictool usage" 2021-12-13 18:02:09 +00:00
David Lynch d228ca0f67 Update abtest bucketing for newtopictool usage
Trigger off the (absence of the) new preference for tracking topic tool
usage.

Change the name of the bucket preference so anyone who was enrolled in
the prior abtest won't find themselves re-enrolled.

Update the abtest enrollment code so it explicitly sets the preference
for the feature. This is a trade-off -- it does mean that we'll need to
special-case *unenrollment* once the abtest is disabled if we want to
just quietly revert people to the wiki's default, but it also means that
Special:Preferences will be accurate.

Bug: T291307
Change-Id: I659679e05b65fc7db05e249114e5a7de4cf55816
2021-12-13 18:45:37 +01:00