Commit graph

185 commits

Author SHA1 Message Date
jenkins-bot 939810f8fe Merge "Change feedback link for new topic tool" 2021-05-26 18:59:28 +00:00
Ed Sanders 2b3345af11 Change feedback link for new topic tool
Bug: T279400
Change-Id: I5d72552f45a63199c0fbb516dc94aef19945c95e
2021-05-26 11:27:01 +00:00
jenkins-bot 90528f2b49 Merge "Fix adding comments in lists containing <dt> tags" 2021-05-25 19:19:49 +00:00
jenkins-bot 14035f3c7e Merge "Remove cookie hack for loading unavailable tools" 2021-05-25 19:17:19 +00:00
Bartosz Dziewoński ee524d6bd6 Remove cookie hack for loading unavailable tools
Bug: T277783
Change-Id: I521db842b4b7a98d8d255d418abd0ccb167c5aa0
2021-05-25 20:27:46 +02:00
Timo Tijhof 54eb6691fa Allow talk pages to have a different ParserCache expiry
Using `updateCacheExpiry()` in this way appears to be established
with examples of other use in WMF production such as:
- CategortyTree extension:
  custom cache expiry for pages with `<categorytree>`.
- RSS extension:
  custom cache expiry for pages with `<rss>`.
- intersection extension:
  custom cache expiry for pages with `<DynamicPageList>`.
- Math extension:
  custom cache expiry if `<math>` failed.
- Wikibase extension, Flow extension:
  no caching for certain namespaces or content types.
- Graph extension, Kartographer extension:
  via onParserAfterParse hook, no caching if on preview.

Bug: T280605
Change-Id: Iea41ab8599ffae4622c97d682258b1b64eaf9ba2
2021-05-14 16:59:09 +00:00
Umherirrender 33f94693fb Replace uses of DB_MASTER with DB_PRIMARY
This requires MediaWiki version 1.36

Change-Id: Idc9edb06b2a080ea9d64e6cdac0b68eb14c485f9
2021-05-13 02:11:45 +02:00
Bartosz Dziewoński ffd680ee7f Fix adding comments in lists containing <dt> tags
The issue occurred when replying to a comment consisting of multiple
list items, starting with a <dt> (instead of the expected <dd>), so
that the comment is considered to be unindented.

Modifier tried to add the reply directly inside the list (<dl>) rather
than inside the last list item (<dt>), which caused it to be confused
about indentation levels and try to un-indent more times than there
were indentations.

The simplest solution, given the existing code, is to add the reply
outside the list instead, in a new list. This results in a "list gap"
(<dl><dt>...</dt><dd>...</dd></dl><dl><dd>...</dd></dl>), but I think
it's acceptable for this rare case.

There are separate tests cases for old Parser and for Parsoid HTML,
because they parse the original wikitext differently (with the old
Parser producing HTML with a list gap too).

Bug: T279445
Change-Id: Ie0ee960e7090cf051ee547b480c980e9530eda51
2021-04-21 16:00:07 +02:00
Bartosz Dziewoński 2352fefb58 Migrate cookie hack users to beta feature
Bug: T277783
Change-Id: I455cab2acd0729b1c117b65cc1ede0ad9eb651cf
2021-04-14 20:36:32 +02:00
jenkins-bot 282f14afe8 Merge "Make sourcemodetoolbar preference available" 2021-04-06 23:44:44 +00:00
Bartosz Dziewoński 18cbae137f Make sourcemodetoolbar preference available
Change-Id: Icc8e254453ee2b2d74e4890744ec7f4512197627
2021-04-06 23:36:09 +00: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 86e5410df3 Add explicit dependency on mediawiki.api
We require it, but it was only loaded by some other dependency.

Change-Id: Ibadc7987f53fe2d07c034e9c8b4da16e2c14b15f
2021-03-20 17:34:38 +00:00
Bartosz Dziewoński 9da3949c47 Add accessibility labels to a few controls
Topic title field and old wikitext reply field had only placeholders,
but no labels.

Mode selector had labels on individual items, but not on the main
control.

Change-Id: I422e7e5baa8711340a1bb82255e788f2272c45c9
2021-03-18 15:15:40 +01:00
Bartosz Dziewoński 58c078437d Improve mode selector keyboard interactions
When there are just two modes, using arrow keys to switch between
them is not intuitive. The focus moving from the selector to the
body widget afterwards is even less intuitive.

Override default TabOptionWidget to allow options to be highlightable
(not just immediately selectable), and mark the current mode's tab as
disabled instead of selected (but make it look selected).

This results in intuitive keyboard interactions (tabbing to the widget
highlights the other tab rather than the current one, pressing enter
switches to it).

Bug: T274423
Change-Id: I9d358d5f301cbf081380ef5d34ccc8c4e146652e
2021-03-18 15:15:40 +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 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
Bartosz Dziewoński 1c3fada1fb Make CommentUtilsTest a proper unit test
Documentation:
https://www.mediawiki.org/wiki/Manual:PHP_unit_testing/Writing_unit_tests_for_extensions#Two_types_of_tests

We can do this because the tested methods do not depend on any globals
or on MediaWiki being installed.

In addition to being the new hotness, MediaWikiUnitTestCase allows the
test classes that use it instead of MediaWikiTestCase to start up much
faster. In my testing, running this test case individually now takes
0.35s, compared to 1.1s before.

Try:
* With new code:
  time php tests/phpunit/phpunit.php extensions/DiscussionTools/tests/phpunit/unit/CommentUtilsTest.php
* With old code:
  time php tests/phpunit/phpunit.php extensions/DiscussionTools/tests/phpunit/CommentUtilsTest.php

Change-Id: I771b1f3d101a394ee869e42547d9ae7839397752
2021-02-02 15:37:17 +01:00
Ed Sanders bf51f1f65c Use new HookHandler system and group hooks by purpose
Bug: T273303
Change-Id: I2d940e1944a9d7686bf7bc544a318c88c0b2afad
2021-02-01 22:34:57 +00:00
jenkins-bot 8d999c5ebf Merge "Separate dialog for abandoning a new topic" 2021-01-20 00:04:29 +00:00
jenkins-bot 994abdac39 Merge "Store reply links in the parser cache" 2021-01-19 21:35:36 +00:00
Bartosz Dziewoński 37b574f165 Separate dialog for abandoning a new topic
Bug: T269190
Change-Id: Ie4f486b0641edea369702631556d8ea31f991370
2021-01-19 21:40:21 +01:00
Ed Sanders 32789a9a55 Store reply links in the parser cache
Splits the cache on the reply links feature being enabled
for a particular user and title.

An additional check is done after parsing in case the user
has the feature enabled via query string or cookie.

Bug: T267404
Depends-On: I883a37fd67108243e7a20683b1a5d59fd0f6e39f
Change-Id: I3bc06ca7d4aea7f0fe39eef0e77ad88d1f9c1043
2021-01-19 17:01:53 +00:00
Bartosz Dziewoński 8f42c74985 Fix skipping to the end of paragraph, now it considers nested tags
Add yet another tree walking utility: CommentUtils::linearWalk().
Unlike TreeWalker, it allows handling the beginnings and ends of nodes
separately – kind of like parsing a XML token stream, or kind of like
VisualEditor's linear model.

(Add unit tests for this utility. The simple.html test case is copied
from [VisualEditor/VisualEditor]/demos/ve/pages/simple.html.)

Use this utility to stop skipping when we reach either a closing or
opening block node tag. Previously we'd skip over such tags inside
nested "transparent" nodes (like <a>, <del>, or apparently <font>).

Bug: T271385
Change-Id: I201a942eb3a56335e84d94e150ec2c33f8b4f4e0
2021-01-18 18:20:20 +00:00
Bartosz Dziewoński 0da00d44be Broken test cases for a big mess of <font> tags
Bug: T271385
Change-Id: I26b08923583593f40a372ef6614524f69781a87a
2021-01-18 18:20:13 +00:00
David Lynch 27a995d5a2 A/B test bucketing for beta enrollment
If DiscussionToolsABTest is enabled (set to `all` or a feature), logged
in users who have never used the tool before will be assigned to an a/b
test bucket. If they're in the test bucket, they get the feature
enabled.

If they manually set their beta feature preference, we don't override
that but do maintain their bucket for logging purposes.

Bug: T268191
Change-Id: I9c4d60e9f9aaef11afa7f8661b9c49130dde3ffa
2021-01-13 10:32:00 -06:00
Ed Sanders 706f4438fc Add "new topic" user preference
Bug: T270119
Change-Id: Ie27ea645602f7533610826cbc0cc422e3682d863
2021-01-12 20:15:46 +00:00
Bartosz Dziewoński d76143bc08 Ability to add new discussion sections
1. Extend the JS modifier to allow adding top-level comments
   (that is, replies to headings). PHP modifier doesn't do this
   because we'll save the changes using paction=addtopic instead.

2. Subclass CommentController to allow adding a new heading and a
   top-level comment underneath it at the same time.

3. A lot of ugly code in ReplyWidget to customize the interface
   for this case. Much of it should probably be moved to
   CommentController/NewTopicController.

Bug: T267595
Change-Id: I9c707bb7f7aae1b92c72fb4dee436490f8c8409b
2021-01-12 20:15:28 +00:00
Bartosz Dziewoński 1c8ca53c92 Catch when no changes are actually saved when posting a comment
Bug: T268069
Change-Id: Ib9c136d846668335884a242322d5b0d4e038c6b1
2021-01-08 22:39:18 +00:00
jenkins-bot 4b1fe2d3b8 Merge "Refactor availability checks" 2021-01-05 19:04:29 +00:00
Ed Sanders dcc23f1108 Refactor availability checks
Allows for multiple features in the near future.

Separate availability and enabled.

Separate User/Title/Output checks.

Change-Id: I454bd8407675749d93ff3d2b4c5d624b433204db
2021-01-05 19:42:37 +01:00
Ed Sanders fb6146053a Convert highlighter.css to less
Change-Id: I41f6d9536a589b6423f4fc619d5058335083a570
2020-12-23 16:50:32 +00:00
Bartosz Dziewoński 7c01e20e47 Add postEdit notification
Per T267595#6656121

Bug: T268994
Change-Id: I2c47fc36ff6515b1f5f5e6bfd11f41eec9c1cd86
2020-12-01 21:43:39 +00:00
jenkins-bot d52f6334ea Merge "Show keyboard shortcuts in button tooltips" 2020-11-26 18:12:03 +00:00
Ed Sanders 1871c70378 Show keyboard shortcuts in button tooltips
Bug: T264913
Change-Id: I3c5b248f7c7b0ef381baab84fe98d4ba0cefd35a
2020-11-26 19:06:17 +01:00
Bartosz Dziewoński 366dc2387e Add tests covering it.wp unsigned comment template
Bug: T268178
Bug: T268589
Change-Id: Icd353275b3b8191eddbff4d72984a8c2c8e6cdd6
2020-11-25 02:08:03 +01:00
Ed Sanders d0bcec6196 Enable DT server side via a cookie to preserve user enable hack
Bug: T265499
Change-Id: Ied330c633732651d1c4e136646afd676ceb570c7
2020-10-19 21:42:58 +01:00
Ed Sanders 64392af485 Add reply links on the server
Bug: T252555
Change-Id: I4e60fdbc098c1a74757d6e60fec6bcf8e5db37c1
2020-10-08 13:27:08 +01:00
Bartosz Dziewoński f934e9aefd Add integration tests using pages from sr.wp
For testing our handling of language variants.

Bug: T259818
Change-Id: Id25b537fecd789640c209ff7f30e777455a3aece
2020-09-16 22:07:16 +00:00
jenkins-bot c02f54a848 Merge "Edit summary in advanced mode" 2020-09-14 22:29:59 +00:00
Ed Sanders ebaa132ebf Edit summary in advanced mode
Bug: T249391
Change-Id: Ibfd1cf77293d30b8e0d9869bbdc9aae2aa830a06
2020-09-14 22:29:54 +01:00
Ed Sanders 38b5a9c0fe Create preference for turning off reply tool once out of beta
Bug: T259943
Depends-On: I75d38560a649794effbfc07cab1de0cc2e18f57b
Change-Id: Iec472bddd92e821d924a18db1734e8da6188b3dd
2020-09-11 22:16:57 +00:00
Bartosz Dziewoński 14fb013515 Match handling of "signature scan limit" between JS and PHP
PHP was counting UTF-8 bytes, JS was counting UTF-16 bytes.
Both should have been counting codepoints (although it doesn't
really matter as long as they both count the same things).

I noticed the issue after adding some tests using the Cyrillic
script, when one case had different results in PHP and JS:
Id25b537fecd789640c209ff7f30e777455a3aece.

Change-Id: Ic31240678f71ba48e6ec202126bf490cea12bb66
2020-09-08 03:27:01 +02:00
Bartosz Dziewoński ff05e0c0b5 Improve error message for edit conflict
Bug: T261788
Change-Id: I079517ad6e258dd23b9048f4133f18cbb087acd9
2020-09-01 22:33:25 +02:00
Bartosz Dziewoński 934872a170 Add integration tests using pages from ckb.wp
This is primarily to cover the handling of localised digits,
which previously wasn't being tested, leading to T261706.

Bug: T261706
Change-Id: I9de7f01f77e767e9048c85604b559af4bca0de91
2020-09-01 01:50:33 +02:00