Commit graph

341 commits

Author SHA1 Message Date
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
Ed Sanders 06d14d8c8f Visual enhancements: Fix loading of icons
* clock, userAvatar, speechBubble were dropped before topic
  containers was merged
* Load ellipsis & edit icons on mobile only
* Load bell & bellOutline for topic subscriptions button

Change-Id: I77d1336627b564be756e3ec50b4686b8f9ac72dc
2022-07-27 18:24:54 +02:00
Ed Sanders 2960853088 Move subscribe button up on desktop
Bug: T312674
Change-Id: I419883b5f9a4291b4bf575d57195d553fd5e291e
2022-07-27 13:55:03 +01:00
Ed Sanders df1cd6be80 Prepend subscribe links to headings
This ensures they stay aligned with the top of the heading when text wraps.

Bug: T313406
Change-Id: Ifd8f93f63a1b3e3e4bd38a1d74f9afed647f7e68
2022-07-27 13:48:28 +01:00
Ed Sanders 6d9b0ec6b4 Show topic container even if heading is unsubscribable
Bug: T312140
Change-Id: Ie0412b9f238d5ff8e54fd2ea358c1c26e303f4e1
2022-07-23 01:21:52 +02:00
jenkins-bot d15a8c931a Merge "Separate ContentThreadItem and DatabaseThreadItem etc." 2022-07-19 16:03:02 +00:00
Ed Sanders c3efa2fd89 ImmutableRange: Fix setStart/setEnd to avoid backwards range
The new behaviour better matches the DOM spec.

Change-Id: Ib795e99cdaeedfb1d9e03eb888dd0a243028a61e
2022-07-11 21:40:09 +00:00
Bartosz Dziewoński 880f9755e0 Separate ContentThreadItem and DatabaseThreadItem etc.
Rename ThreadItem to ContentThreadItem, then create a new ThreadItem
interface containing only the methods that we'll be able to implement
using only the persistently stored data (no parsing), then create a
DatabaseThreadItem. Do the same for CommentItem and HeadingItem.

ThreadItemSet gets a similar treatment, but it's basically only for
Phan's type checking. (This is sad.)

Change-Id: I1633049befe8ec169753b82eb876459af1f63fe8
2022-07-04 23:35:50 +02:00
jenkins-bot 32d4d879a8 Merge "Add some missing typehints" 2022-06-29 15:24:25 +00:00
Ed Sanders 4accd2fc7e Add some missing typehints
Change-Id: Idb111dd907972d9e02dab4b26c3fc106b12b1035
2022-06-29 15:15:52 +00:00
Bartosz Dziewoński af6e4a29eb ApiDiscussionToolsPageInfo: Fix fake headings with null name/id
name and id are supposed to never be null. Calling getName() or
getId() on this object would cause an exception.

Change-Id: I5f95b7d9e4ce4550b550ee758fc86f032b676731
2022-06-29 02:52:31 +02:00
Ed Sanders 7fc5a0c29d Topic containers: Design iterations
Bug: T310914
Change-Id: I9000f9902d612c58c6b3bc8b762232ca6dd9724f
2022-06-25 12:54:39 +00:00
Ed Sanders 63acc121fc Thread containers: Link latest comment timestamp to corresponding comment
Bug: T309751
Change-Id: Id969bd7a76544d6024b8714c45cdfe5c59b71a0b
2022-06-24 21:44:21 +00:00
Bartosz Dziewoński 109a50cb34 Truncate timestamps in comment IDs / names
For comments posted on or after 2022-07-12 (configurable), use a
shorter format, identical to the timestamps MediaWiki uses in URLs.

Changing the format for already existing comments would involve
difficult migrations, therefore we elect not to do it.

Bug: T304595
Change-Id: I387051a6a3a1d84cfae45c3e1516db870cc8b977
2022-06-24 00:49:58 +02:00
Ed Sanders da64c43ccc Show thread metadata in section headers
Bug: T269950
Change-Id: Ifa47ddcbccf288be0bbecd5961eab7c5122aab7b
2022-06-23 17:17:09 +01:00
jenkins-bot 80173ed010 Merge "Convert more self:: to static::" 2022-06-15 19:42:57 +00:00
Ed Sanders 1f002f812f Convert more self:: to static::
These are from patches that were already in progress before
we did the first run of conversions.

Change-Id: Id883e693a518130cfcc80bfd0f2874cbd9593446
2022-06-14 22:53:00 +01:00
Ed Sanders 0ad9b4c6b2 Move placeholder heading level (99) to a constant
Change the HeadingItem constructor to take a 'null' headingLevel
and store this internally with the constant. Change the JSON
serializer to convert this back to null.

Change-Id: I27508eed75d94b99c5189548919309f8da7deb75
2022-06-14 22:51:49 +01:00