Commit graph

321 commits

Author SHA1 Message Date
Bartosz Dziewoński 49c1dde336 Abort DiscussionTools checks early when viewing a special page
Previously we relied on the NamespaceInfo check below to reject
special pages, but after commit 07d885248bc54bdc0f12d9745916c794d45ec81c
in MediaWiki core, PageProps throws an exception when called with a
special page.

Bug: T281180
Depends-On: I32c94107fde96b9d6344c77b621be9b3b9b7faaf
Change-Id: I0fd893c63a6e92f6c84e7aa92270852e1137fcad
2021-04-26 18:38:06 +00:00
Ed Sanders eae0c1e6e1 Implement hidden tag for source mode with toolbar
Bug: T279157
Change-Id: I0244530580c7243e4db33848d36c336d8e5e8a08
2021-04-22 17:44:00 +00:00
Ed Sanders 2f40fd96b1 EventDispatcher: Store comment name in event metadata
This will probably be useful later, so better to ensure
the data is captured now.

Change-Id: I8936ee85a2775ad48839e9c3ebf5bc3d5355c501
2021-04-22 16:23:39 +00:00
Ed Sanders a9537782ac EventDispatcher: Compare new comments by name, not ID
Change-Id: I9d7907dda0f443e4e3b0463a127ea4def68051f3
2021-04-22 16:15:09 +00:00
Ed Sanders e20fcea122 EventDispatcher: Only generate events if author matches user
Bug: T280783
Change-Id: I8a0ea2ac3aefb66b693ee219b88619248bb25fb2
2021-04-22 16:14:01 +00:00
Ed Sanders 888d554ecf Don't split parser cache when reply tool is enabled by default
Bug: T279864
Change-Id: I16f1546e1373311563b8a90d6a025b0b45ffb793
2021-04-21 11:57:37 +00:00
Ed Sanders 722a4e5198 Avoid splitting ParserCache on user language
Bug: T280295
Change-Id: I87eab83803d24c11db4d723377bf7b40390b2e70
2021-04-21 11:57:30 +00:00
Bartosz Dziewoński 0b82162149 CommentFormatter: Fix regexp in topic subscription postprocessing
The regexps needs to be non-greedy, otherwise it could swallow up a
large chunk of the page (up to the next comment).

I noticed this when adding tests for this code, in the 'unclosed-font'
test case (Ief9648b8805fadcc170c54b627eb669cc8b907b6).

Change-Id: I5f67a9599b0cb07bdd53abeebac9ada221181b66
2021-04-21 11:57:21 +00:00
Bartosz Dziewoński 228b81fab9 Move implementation of subscribe buttons to CommentFormatter
Change-Id: Iad59ea047ed12bb34b483a94f443b39de6985bd3
2021-04-21 11:57:17 +00:00
Bartosz Dziewoński 1957c340b9 Remove unused variable
Change-Id: Ia4ad464b765c67aea27092a161d28ad1d890e96a
2021-04-21 11:57:11 +00:00
jenkins-bot 69fc17db81 Merge "Rename CommentFormatter::addReplyLinks" 2021-04-21 11:50:42 +00:00
Bartosz Dziewoński 4bbfe6cb5d Rename CommentFormatter::addReplyLinks
Bug: T280351
Change-Id: I0d7627d63407e11cca6091f78e4d440eec6efa91
2021-04-21 11:24:03 +00:00
Bartosz Dziewoński dcd898ed6d CommentFormatter: Add 'ext-discussiontools-section' class instead of overwriting
Bug: T280433
Change-Id: I3746913b7212f252a1632db01e77e53038719cb5
2021-04-19 23:47:53 +02:00
Bartosz Dziewoński a3f665e816 Remove <header> tags around headings for compat with MobileFrontend
We added it because the initial designs for the subscribe action were
much easier to implement like this, and topic "containers" (T269950)
would have required it.

However, the latest design of the subscribe action will not need it
(T279149), and topic containers are still very far away, so let's
remove it for now.

Bug: T280433
Change-Id: I21a23e9bea43f24d265750926fbd62b99038d3f1
2021-04-19 17:47:43 +02:00
jenkins-bot 58fc1753fe Merge "Include comment names in 'transcludedfrom' API response" 2021-04-16 11:30:22 +00:00
jenkins-bot ef7073b8fd Merge "Simplify how warnings for IDs equal to legacy IDs are avoided" 2021-04-15 23:31:45 +00:00
Timo Tijhof 269514f533 Hooks: Use WebRequest::getRawVal where possible
The 'dtenable' does not appear to take user-provided content that
requires language normalization. In general getRawVal should be used,
or if it's user input that needs normalization, use getText(). Perhaps
one day we'll alias or deprecate getVal (which is currently an odd
mid-way hybrid, most closely to getText; originally created for
EditPage.php textareas).

Change-Id: I8364c84f8c4f700da6e208df2e87c29bf254d685
2021-04-15 02:30:12 +00:00
Bartosz Dziewoński 9420f22e9d Don't allow query and cookie hacks to enable topic subscriptions
We can't allow it, because the required database tables may not exist
yet (T280082).

This is meant to be temporary until we complete DBA review and the
tables are created.

Bug: T280082
Change-Id: I8f947b779c6829763d3413931c6d354e6f7aee4d
2021-04-14 00:08:52 +02:00
Bartosz Dziewoński 3e319251f0 Fix check for your own talk page on subpages
Bug: T279604
Change-Id: I955a602ffb39f2443de9a3b165d8105ea3762058
2021-04-12 17:06:02 +02:00
Ed Sanders a555db7892 Topic subscriptions: Don't register notification type/group unless enabled
Bug: T279671
Change-Id: If3c46b992654c40daeeccaf8a3dcedde680c8404
2021-04-12 15:04:43 +00:00
Ed Sanders f3422f40a6 Disable topic subscriptions API when feature is unavailable
Bug: T279671
Change-Id: Ib5a233329e7e6697c198bc0ae10c770282fd9470
2021-04-12 15:04:07 +00:00
Ed Sanders f6c9508001 Create constants for feature strings
Change-Id: I2d7bf18faf6345a4816c2ebef9744c4e6f62cc40
2021-04-12 14:40:51 +00:00
Ed Sanders 23a490deca Topic subscriptions: Don't generate events when feature is unavailable
Bug: T279671
Change-Id: I8f57b2a1885619db868f25ea68208c2fad5fc040
2021-04-12 14:40:27 +00:00
Ed Sanders 6cafd7735d Topic subscriptions: Only check for events on talk pages
Change-Id: Ic2b7536baea58fb4868cec6f477e72bd8b717e3a
2021-04-12 14:40:13 +00:00
Bartosz Dziewoński bfe6a36514 Include comment names in 'transcludedfrom' API response
As of 7ad6328223, we also use this data
to check whether comments exist on the page, not only whether they're
transcluded.

Follow-up to 42ce942c86.

Bug: T275821
Bug: T273413
Change-Id: I95eb85354e7b84cc10ab703d28315d0667696f4c
2021-04-07 22:46:36 +02:00
Ed Sanders 0a39c11914 Echo wiring for topic subscriptions
Depends-On: I60818d57552946857077dee93b0adb036621b791
Change-Id: I7e0996843cdd70141e19d5c7ce66122204efa1b7
2021-04-06 23:28:28 +02:00
Ed Sanders eb7e682d2f Topic subscription front end
Bug: T276996
Change-Id: Ifb62c04c2a0ea8399749b22021d6a1c5a079bf94
2021-04-06 23:28:28 +02:00
Ed Sanders 0bf7539eb9 Topic subscription action API
Bug: T264885
Change-Id: Ie4ddbcef8769c124039a72f544702c9a88bc49eb
2021-04-06 21:25:24 +00:00
David Lynch 86be6f83da Service to interact with topic subscriptions
Bug: T264885
Change-Id: Ie9592de655f50e1d0cf02a7f795b5203398a9696
2021-04-06 21:25:13 +00:00
David Lynch 5b8646f73f Create table for topic subscriptions
Bug: T264885
Change-Id: I92d0362eac80ae1ae70839e26e2c084003862a5f
2021-04-06 21:24:53 +00:00
Ed Sanders 4c27187500 Make the source mode toolbar a user preference feature
Bug: T275950
Change-Id: I099af342f378215c68092d165dd88de1807d29d2
2021-03-31 22:40:53 +02:00
Bartosz Dziewoński 566d4d92db Trim wikitext for preview
And change some uses of trim() to htmlTrim() for consistency.

Bug: T276612
Change-Id: I1f55f4793af8f3dda597288c9e3427abe31c37c9
2021-03-24 18:53:41 +01:00
Bartosz Dziewoński 3ac540af95 modifier: Fix whitespace trim inconsistency
The JS and PHP trim() methods remove different characters.

Change-Id: I8ae5526ea5033e345b6a6b63ea447c394956d988
2021-03-24 18:53:21 +01:00
Bartosz Dziewoński 42ce942c86 Introduce comment "names" to identify comments across revisions/pages
The existing comment IDs can't be used to find the same comment on
a different revision or page (when it's transcluded), because they
depend on the comment's parent and its position on the page.

Comment names depend only on the author and timestamp. The trade-off
is that they can't distinguish comments posted within the same minute,
or in the same edit, so we will still need the IDs sometimes.

Prefer using comment names when replying, if they're not ambiguous.
This fixes T273413 and T275821.

Heading names depend on the author and timestamp of the oldest comment.
This way we don't have to detect changes to the heading text, but we
can't distinguish headings without any comments.

Bug: T274685
Bug: T273413
Bug: T275821
Change-Id: Id85c50ba38d1e532cec106708c077b908a3fcd49
2021-03-23 16:08:42 +00:00
Bartosz Dziewoński b28290fa62 Simplify how warnings for IDs equal to legacy IDs are avoided
I don't like the extra parameter.

Follow-up to d05109b24d.

Change-Id: Ic0f403a816fd3182982002da326bb32d591ebcf7
2021-03-22 20:15:07 +00:00
Ed Sanders c4de603ef9 Give comments IDs so they can be scrolled to with hash links
Bug: T265268
Change-Id: Idb985ed38bdb74e23cb7840899a61dc919f05f6f
2021-03-20 15:43:23 +00:00
Ed Sanders 4a0802065c Make IDs (to be used as URL hashes) wikitext safe
* Use hyphens instead of pipes a separators
* Use underscores for spaces in usernames

Change-Id: I6efd9739fc73e45002e50e64c43ce0de1c2f1239
2021-03-18 20:45:21 +01:00
Bartosz Dziewoński a103abb8ae Ignore warnings about legacy IDs in tests
Change-Id: I3c74b4e65aac9b84494917547cce7eb6a75995b4
2021-03-18 20:42:03 +01:00
Ed Sanders ece8ff69ff Change dt- class prefix to ext-discussiontools-
Longer, but follows the style guide and less likely to conflict.

We need to account for init classes in the cache being around for
a while.

Change-Id: I738bc93393850db320fdbda2b003ca8ac40556da
2021-03-13 14:42:39 +00:00
jenkins-bot 72f1ff092f Merge "Allow users to continue using reply tool after disabling A/B test" 2021-03-10 06:40:58 +00:00
Bartosz Dziewoński 68ad48f56f Allow users to continue using reply tool after disabling A/B test
Bug: T276967
Change-Id: I1fa120ded9ac3673fd3e5005618b3312ffd0aaf5
2021-03-09 22:20:03 +01:00
Bartosz Dziewoński 44f2209abf Trim signatures when added in an empty existing node, too
Add unit tests for appendSignature().

Bug: T276612
Change-Id: Ic44c52f4d54492e092f9396c626380e2637b6f0f
2021-03-08 23:38:46 +00:00
Ed Sanders ccc19d8df2 Add 'href' to reply links for better compatibility with skins
Change-Id: Id948d576bbe5a6d43c4f8a06cdb2cd8ad19be193
2021-03-09 00:04:53 +01:00
Ed Sanders 6224c11ff1 Always load init CSS when tools are available for a title
Also, make init CSS available on mobile.

Bug: T274311
Change-Id: I8f63fdb249cdd8ccdc6d1c4944d2622ac7d668cc
2021-03-06 12:08:50 +00:00
Ed Sanders 45cda20cf3 Don't attempt to put comment markers in <noscript> tags
Bug: T276455
Change-Id: Ia427d97528b137111145ac79680972a660f28e37
2021-03-04 22:24:04 +01:00
Bartosz Dziewoński f5059e6ea6 Don't detect comments within 'cite' elements too
Follow-up to 024a978ffd.

Bug: T275881
Change-Id: I53448ad22cd0531e7fd4aa0ea5d15782879cce14
2021-03-01 21:40:43 +01:00
jenkins-bot 0eb37a87df Merge "Don't detect comments within quotes" 2021-02-28 22:56:20 +00:00
Bartosz Dziewoński 024a978ffd Don't detect comments within quotes
Bug: T275881
Change-Id: I8f7a4279837bd95ebf5b604ff350c0a3f29c2c05
2021-02-28 22:49:48 +00:00
jenkins-bot 8bb5eea999 Merge "Improve signature detection to handle formatting on the timestamp" 2021-02-27 22:54:50 +00:00
jenkins-bot c5874422df Merge "CommentUtils: Fix edge case bug in getCoveredSiblings()" 2021-02-27 22:54:46 +00:00