Commit graph

358 commits

Author SHA1 Message Date
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 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
jenkins-bot 1f9645cb0b Merge "Add signature on separate line if wikitext comment ends with a list" 2022-08-11 13:46:42 +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 a27765319b CommentFormatter: Set 'data-mw-comment' even when reply tool disabled
Move the code that generates these wrapper nodes and attributes
from postprocessReplyTool() (only called when reply tool is enabled)
to addDiscussionToolsInternal (always called).

This undoes some changes from 31c57d594a and 980b2c38bc.

Bug: T314707
Change-Id: I07ed210375d494047670015410430c087d67f21a
2022-08-06 14:16:37 +00:00
Bartosz Dziewoński d223626585 Add signature on separate line if wikitext comment ends with a list
Bug: T263217
Change-Id: Idd15a9add798368493ae7af5270f972895470de9
2022-08-06 16:08:13 +02:00
Bartosz Dziewoński 9c68e058ef CommentFormatter: Add test cases for mobile version
Also, rename the files, since CommentFormatter now does more than
replies.

Change-Id: I1ae432c06badd9790274db27881c2222c0439ba8
2022-08-02 14:21:36 +01:00
Bartosz Dziewoński 31c57d594a Do not duplicate item JSON in page HTML
Rather than setting it on both the reply link and the reply button,
set it on their parent element.

Update ReplyLinksController to handle this.

Change-Id: I650e9c0ebd354a82b8f66a63c5b4c02b2e29b105
2022-08-01 22:14:50 +00: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
jenkins-bot d247842772 Merge "Ignore "tracked" templates at the beginning of comments" 2022-08-01 14:52:39 +00:00
jenkins-bot 6b5352fb1c Merge "Add more tests cases using the "tracked" template" 2022-08-01 14:51:54 +00:00
Bartosz Dziewoński ddd391b6db Ignore "tracked" templates at the beginning of comments
This improves the behavior when replying to these comments
and the message snippets shown in notifications.

Bug: T313097
Change-Id: Ia10400472c9e999fa526c7437a03b72461c37b74
2022-07-31 03:56:36 +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
Bartosz Dziewoński 612544de5f EventDispatcherTest: Use null instead of special placeholder file
It's easier to read this way, not sure what I was thinking when I wrote this.

Change-Id: Ie59f86143885593214d85ec05576212dc4624995
2022-07-31 03:29:48 +02:00
jenkins-bot 508e6446c5 Merge "API ThreadItemsHTML: improve generation of othercontent" 2022-07-28 21:56:56 +00:00
David Lynch ec0e2920ae API ThreadItemsHTML: improve generation of othercontent
Othercontent would often contain the opening tag of the next heading /
section. By looking for the closest node with a previousSibling we can
more-reliably escape the heading.

Also, only add the initial placeholder if there's content before the
first heading. We do this by testing for any siblings before the
startContainer of the first heading -- if there are any, assume this
means there's some sort of content. (This can still result in a
placeholder with `othercontent:""` if there's only whitespace before
the first heading.)

Bug: T313850
Change-Id: I080205b74413c46d3cf3442e79276145aaa9439c
2022-07-28 02:51:18 -05:00