Commit graph

372 commits

Author SHA1 Message Date
Bartosz Dziewoński 433e57394c Use PHP 7.4 property types
Change-Id: I788db64f0c0c00894d77256b7f016d44eda4bbb1
2022-10-28 21:56:38 +02:00
jenkins-bot da907eb610 Merge "Don't apply topic containers to table-of-contents heading" 2022-10-26 16:30:28 +00:00
jenkins-bot c9dadbfe7d Merge "Remove support for <span class="mw-headline-number"> in headings" 2022-10-26 16:29:41 +00:00
jenkins-bot d55b8f8d2f Merge "Don't insert comment markers inside <figure>" 2022-10-26 16:28:37 +00:00
Bartosz Dziewoński 9cbb0a8c60 Don't apply topic containers to table-of-contents heading
Change-Id: I3abbf7907907f6280e6b58bcf4307c0ce3b1898e
2022-10-25 18:59:25 +00:00
Bartosz Dziewoński c6cd20f682 Remove support for <span class="mw-headline-number"> in headings
This feature has been removed from MediaWiki in change
Ic9ed88f419419cf4cc5cc32010539eea8b76314b.

Change-Id: If11b33589f47eab614f5129b38e80d0f3cafa083
2022-10-25 18:59:05 +00:00
jenkins-bot 6ab2abc958 Merge "ThreadItemStoreTest: Add test for old revisions of indistinguishable comments" 2022-10-25 00:05:00 +00:00
jenkins-bot 2e28320eb2 Merge "ThreadItemStore: Fix updates for identical revision timestamps" 2022-10-24 23:57:07 +00:00
jenkins-bot 095277b40c Merge "ThreadItemStoreTest: Add test for identical revision timestamps" 2022-10-24 23:57:05 +00:00
jenkins-bot 11d10e9e64 Merge "ThreadItemStoreTest: Use a consistent ordering for the output" 2022-10-24 16:23:30 +00:00
Bartosz Dziewoński d2df103803 Don't insert reply tool outside <section> on mobile
Bug: T319148
Change-Id: I7db0ef1980f4997b77593f3d43d35886ecd8a4ae
2022-10-21 01:20:13 +02:00
Bartosz Dziewoński 0116bed3ad Add test case for <section> wrappers on mobile
Bug: T319148
Change-Id: Ic8e29a8a5626b2dee1c258fec18a9b016ecae06b
2022-10-21 01:20:13 +02:00
Bartosz Dziewoński 66cac8523e ThreadItemStoreTest: Add test for old revisions of indistinguishable comments
Just to confirm that this works correctly, because I broke it a few
times in different ways while working on T321121.

In this scenario, discussiontools_item_revisions contains rows for
the oldest and newest revisions of pages containing each comment
distinguishable by name, as well as extra rows for the newest
revisions of comments indistinguishable by name, so that they can
be looked up by ID.

Change-Id: Ic8450a6b082ed343dd633d3a43c50696b5d6d2bb
2022-10-20 03:50:47 +02:00
Bartosz Dziewoński 33f4006713 ThreadItemStore: Fix updates for identical revision timestamps
Use revision IDs to break the tie, consistently with MediaWiki (see
RevisionStore::getRelativeRevision) instead of assuming that the
revision we're processing now is somehow both older *and* newer than
the other one (the mind boggles how that ever made sense to me).

Change-Id: I9f1a07124301a36be68578d908353b72f0442c00
2022-10-20 02:37:47 +02:00
Bartosz Dziewoński c922e1babd ThreadItemStoreTest: Add test for identical revision timestamps
discussiontools_item_pages row itp_id=5 has incorrect
itp_oldest_revision_id. It should point to the older of the two
revisions with the same time, but it points to the newer one.
discussiontools_item_revisions row is missing.

Depends-On: I56f0e161e5438d5f77b7d53d4db7411f90f97d05
Change-Id: I61ed42515891a84729455a7a32c98276c7cacd40
2022-10-20 02:36:40 +02:00
Bartosz Dziewoński ed23ff1ad7 ThreadItemStoreTest: Use a consistent ordering for the output
In preparation for changes affecting how the data is stored (T321121).

Change-Id: I1d6edeb016431dd33e50cfbea1533a92b056a2a7
2022-10-20 01:49:19 +02:00
jenkins-bot 3c53a489cf Merge "CommentFormatter: Always add the overflow menu" 2022-10-18 16:16:42 +00:00
Bartosz Dziewoński 1d6ba985be Fix parsing of non-English titles in JS tests
Same issue as b68832ace0 in PHP.

Change-Id: Ide6ebc47929b597e6dc23df696d87bb3130ce276
2022-10-17 17:10:53 +02:00
Bartosz Dziewoński 4b38d72c2e Re-enable fixed JS parser tests
The changes from I39f9b994ce5636d70fea2e935a7c87c7d56dcb26 also make
most of the broken tests pass again.

Change-Id: I165f36235b47dee4bcef115e518bc1e81d2f83a5
2022-10-15 20:24:09 +00:00
Bartosz Dziewoński 361283a332 Ship HTML test files for JS using 'packageFiles' instead of 'templates'
We originally used 'templates' because it seemed like an obvious
choice for HTML files, and because 'packageFiles' requires extra code
to include anything that isn't a .js or .json file.

However, the templates are expected to be HTML fragments rather than
whole documents, and they are parsed in a particular way that takes a
lot of code to clean up (which we needed to do, because we use the
same test files for testing PHP code).

I tried doing it in the 'packageFiles' way, and the extra code doesn't
seem that bad in comparison after all. Moreover, the 'templates'
mechanism (when used the intended way) feels vaguely deprecated in
favor of Vue.js, and I'd rather move away from it.

This makes the tests faster too (probably mostly thanks to the removal
of the clean up code) – on my machine they go from 1800ms to 1500ms.

(Simplify linearWalk tests, as we no longer need to do weird things
with document fragments to get consistent outputs in PHP and JS.)

Change-Id: I39f9b994ce5636d70fea2e935a7c87c7d56dcb26
2022-10-12 22:45:41 +00:00
jenkins-bot 4b3794f610 Merge "testUtils.js: Fix selector for old parser tests" 2022-10-12 17:24:04 +00:00
jenkins-bot 888fb00c12 Merge "testUtils.js: Serialize timestamp with #getTimestampString" 2022-10-12 17:24:02 +00:00
jenkins-bot d3a359571f Merge "parser.test.js: New test for each case, as in modifier.test.js" 2022-10-12 17:24:00 +00:00
jenkins-bot 03986e6072 Merge "modifier.test.js: Improve test descriptions" 2022-10-12 17:23:32 +00:00
Bartosz Dziewoński 465168112c Use FormatJson helper for outputting pretty JSON for tests
Identical output, fewer constants and regexps.

Change-Id: I50fd536d9122ac91a7261660405219e19d974047
2022-10-12 00:52:52 +02:00
Ed Sanders f32429bb4e testUtils.js: Fix selector for old parser tests
This fixes tests in modifier.test.js. The old parser tests
in parser.test.js are currently skipped.

Change-Id: If1fa8055b3cb6c6b43420ab40dd51af79fa083d9
2022-10-11 17:39:52 +01:00
Ed Sanders 2de72655d8 testUtils.js: Serialize timestamp with #getTimestampString
This currently only makes a difference in some skipped tests.

Change-Id: Ia27fb1cf1bbf2ffdcc471eb6e4dacf4dce44efec
2022-10-11 17:37:20 +01:00
Ed Sanders 6d03608b7c parser.test.js: New test for each case, as in modifier.test.js
Explicitly skip the old parser tests as these are not yet working.

Change-Id: I1a8fbb9b177acd97db9c42250dd6f5226f879ac0
2022-10-11 17:23:40 +01:00
Ed Sanders 045b020ca4 modifier.test.js: Improve test descriptions
Exposes that the old parser tests are asserting 0 comments added.

The tests are passing becaause testUtils.getThreadContainer returns
the empty string for both actual and expected.

Change-Id: I263a258a8db5c35a6fb1fc5ce281f902fc543038
2022-10-11 16:57:46 +01:00
Bartosz Dziewoński 8664de52d1 Don't insert comment markers inside <figure>
…when wgParserEnableLegacyMediaDOM=false. See task for details.

Bug: T320285
Change-Id: I397cb70f915bb8d974fe2796198d252b1be9a368
2022-10-08 23:23:54 +02:00
Bartosz Dziewoński 8ad26730f2 CommentFormatter: Always add the overflow menu
Bug: T318110
Change-Id: I49900e32dc6b5dbca3286a840ce122639e25e9bd
2022-10-02 15:36:45 +02:00
Ed Sanders 0265d401c2 Add @covers CommentUtils to tests that use it
Change-Id: I35d2d0d75bfdbe17fe186eb5cfb47a850a9d6f6a
2022-09-16 13:22:43 +02:00
Ed Sanders fcdabc5fcc Only filter code coverage at the class level
Many methods are covered indirectly, and using method-level
@covers filters means these are reported as not being covered.

Change-Id: I94eb3e8c48209ff0b6bfc09e18c93555bb167e8f
2022-09-15 14:08:30 +02:00
Ed Sanders e24550fae9 Refactor thread summary getters
Replace getThreadSummary with individual getters that call
calculateThreadSummary once.

Change-Id: Ie8a8b4d7cb5121847b78dbc20bca2c8d48c7d857
2022-09-06 23:19:13 +02:00
Ed Sanders 664d5d041a Fix fetching of oldest comment in a thread
The implementation in Parser doesn't descend into sub-thread.
Re-use the getThreadSummary method in ThreadItem and traverse
the thread properly.

Bug: T298617
Change-Id: I318d9012eb83f37ccbe463923524ef2e9f995ced
2022-09-01 21:22:09 +00:00
jenkins-bot 988b076760 Merge "API: always output ISO8601 in the timestamp field" 2022-08-30 20:16:45 +00:00
jenkins-bot cbe48c04e5 Merge "ThreadItem jsonSerialize: make sure callback is applied last" 2022-08-30 20:14:39 +00:00
David Lynch 76919822fb API: always output ISO8601 in the timestamp field
Bug: T315400
Change-Id: Iac4ad334ca41197cb0b36217468113bec331aaac
2022-08-30 11:04:19 -05:00
jenkins-bot 5326f060de Merge "Notify users when a topic they are subscribed to is removed from a page" 2022-08-30 15:59:33 +00:00
David Lynch 4b370a8971 ThreadItem jsonSerialize: make sure callback is applied last
This changes a vast number of test expected-outputs because it affects
the order of the keys when serialized.

Bug: T315400
Change-Id: I6ad2cded6ba7cb2cc5e5ba37ea60f4b18ecc26be
2022-08-30 09:11:46 -05:00
jenkins-bot e680735d63 Merge "Remove all stuff about legacy IDs" 2022-08-27 05:34:48 +00:00
jenkins-bot b9e3043415 Merge "Enhance vector-2022 table of contents" 2022-08-26 20:57:39 +00:00
jenkins-bot 22825f06e6 Merge "Fix subscribe button appearing for unsubscribeable sections with visualenhancements" 2022-08-25 14:59:46 +00:00
Bartosz Dziewoński d33996f8b4 Notify users when a topic they are subscribed to is removed from a page
In the future the notifications can be improved to look up
the new location of the comment, using the permalinks data.

Depends-On: Ia8a21749a8edc20f34b2a3e445278ea6922b9109
Bug: T299657
Change-Id: I5f5e7b73fb84ff0d31fb8260b24066a17da71628
2022-08-25 03:52:58 +02:00
Bartosz Dziewoński cfa45a5f4c Remove all stuff about legacy IDs
We can no longer change IDs so easily, because they're stored in the
permalink database, so remove this mechanism to make sure it's not
accidentally used in the future.

Change-Id: I392ee1f49c48fc2f23d05e9a37c643438b4f2b9a
2022-08-24 01:01:09 +02:00
Bartosz Dziewoński 434944b197 Enhance vector-2022 table of contents
Bug: T307823
Depends-On: I034a579b7ef51950726c9ac056d6c940a7d7d472
Change-Id: Icafc13e1c846549429fe2b3b4a1721c02ab7428d
2022-08-23 19:46:44 +00:00
Ed Sanders 9adafd43a1 Show latest comment info in subtitle
Bug: T306675
Change-Id: I1400dbb50cdf8a0a5e23ce533c84fad96f3fae16
2022-08-23 19:31:40 +00:00
Bartosz Dziewoński 0eeffce1c1 Fix subscribe button appearing for unsubscribeable sections with visualenhancements
We didn't correctly reconcile the changes from
Ie0412b9f238d5ff8e54fd2ea358c1c26e303f4e1 and
I419883b5f9a4291b4bf575d57195d553fd5e291e.

Bug: T315821
Change-Id: I5a93cbb3bf029b352e808cbd9cb1ea3286e20c94
2022-08-23 01:07:14 +02:00
Bartosz Dziewoński 4c17819a76 Migrate usage of Database::select (and friends) to SelectQueryBuilder
Bug: T312466
Change-Id: I99d4402d796421221a1c6c56ef88b023cb495833
2022-08-13 00:32:45 +02:00
jenkins-bot 95fb33fb57 Merge "Store permalink data, implement Special:FindComment/GoToComment" 2022-08-11 17:11:44 +00:00