Commit graph

667 commits

Author SHA1 Message Date
jenkins-bot a18c5c3e3a Merge "Don't show empty page state on redirect pages" 2022-07-28 22:26:11 +00:00
Ed Sanders fcdd6b0ed5 Don't show empty page state on redirect pages
Add the redirect check to shouldShowNewSectionTab.

Try to run cheaper checks before more expensive ones.

Depends-On: I5755863243d8ad336ad20626f439d70eb3b31f32
Bug: T312599
Change-Id: I6848e529a2537d4058613db0c3b900bc9f4f59f8
2022-07-29 00:15:42 +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
Bartosz Dziewoński e1499c0291 More consistently handle new topic tool vs empty state
We had different logic for the empty state on pages that exist and
those that don't. For the second case, we relied on the new topic tool
becoming unavailable in some cases, but that could cause complications
elsewhere (e.g. if the page also had a custom button to add a new
section).

The new topic tool is now available regardless of the page. Instead,
the empty state is controlled separately, by the same method in both
cases.

As far as I can tell, the effect is exactly the same as before.

Change-Id: I5b36e6f027cf76dd0e3a8ee3cb5156fe1eaac8a8
2022-07-28 02:16:07 +02:00
Bartosz Dziewoński 34e755c623 Don't show new topic tool empty state on existing non-talk pages
Bug: T312599
Change-Id: Ie691498f7b89cb34a414cb8dfae9337f1b706685
2022-07-28 01:57:32 +02:00
jenkins-bot 131f00c464 Merge "Add topic containers HTML to parser cache even when feature is disabled" 2022-07-27 19:19:48 +00:00
Ed Sanders 5e2b209314 Add topic containers HTML to parser cache even when feature is disabled
Remove hacks marked as 'TEMPORARY' now that we consider the
HTML to be stable enough.

This will avoid issues with HTML/CSS being out of sync in future deployments.

Bug: T313560
Change-Id: Ie00ff38a422f241add19d500adaf22dfeee10e8c
2022-07-27 17:26:33 +01: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
jenkins-bot d35ff76d81 Merge "Don't enable visual enhancements CSS on mobile when feature is "unavailable"" 2022-07-12 00:26:22 +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
Ed Sanders f739160fb4 Fix infinite recursion when checking for the new topic tool on empty pages
Bug: T312689
Change-Id: Iaf5033a55e3840ef65be0c4994f8b6c00fe2551b
2022-07-09 12:48:17 +01:00
Ed Sanders 09a84e81e5 Don't enable visual enhancements CSS on mobile when feature is "unavailable"
Bug: T312683
Change-Id: Ifa66a62f335b5c2eee9c59284a0f4b851a83b94b
2022-07-08 22:42:39 +01:00
Bartosz Dziewoński 2bc76dabd7 Enable transformations in preview mode
We remove the [reply] and [subscribe] links when they should not be
visible (controlled by 'enableSectionEditLinks' option, which is
disabled when previewing).

Bug: T309423
Change-Id: Ie0d3fba2c4d166daac3ea2e117a246c9584284ca
2022-07-07 23:37:56 +01:00
jenkins-bot caefb1ae39 Merge "Show new topic tool empty state on existing pages with no topics too" 2022-07-07 21:52:36 +00:00
Bartosz Dziewoński a98cd369ba Show new topic tool empty state on existing pages with no topics too
Bug: T312599
Change-Id: I316d2f119b9c899ffaeebc7ec288823c826db092
2022-07-07 21:45:44 +00:00
Bartosz Dziewoński 0735258101 LanguageData: Accept abbreviations in $wgLocaltimezone
Bug: T312310
Change-Id: I4a2952ef834450b4c07c129d32292591a15110fb
2022-07-07 03:12:20 +00:00
Ed Sanders eab257e3a0 New topic tool: Always disable when "Add topic" is not visible
Bug: T312210
Change-Id: I2c9eafccf5d240fdaf711be6ed1d2e4a0a11d673
2022-07-06 13:59:41 +01: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
Reedy 54464f0b0c Add return type to jsonSerialize()
Bug: T311919
Change-Id: Ie77d7bc2902760972b8981a840bef91aae4ce5a3
2022-07-02 17:32:04 +00: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 639fabf647 Pass useskin/mobileformat when previewing/refreshing page contents
These are required to render content correctly on mobile.

Change-Id: I421e1f172e208c4bf9d50eee68f1b0220a78dfbe
2022-06-27 17:15:28 +01:00
Ed Sanders 904f1c2f25 Api: Make type/title required args of previewMessage
Change-Id: I0a0d9bfe3510d9bd6076408ba3819c82cd44ec0c
2022-06-27 12:50:10 +01: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
Ed Sanders b1be63469b Only enable visual enhancements in specific namespaces
Change-Id: I91643d3f07a9ee6f03a18f8e2787ab9cb61bc41d
2022-06-24 16:15:07 +01: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
Ed Sanders d59d5e14f9 CommentFormatter: Escape user input in generated comment
Currently the only user input in a headingItem name is the username
which can't contain a '>', so the regex can't break, but this is
fragile, and we should always do our own escaping.

Change-Id: I14e5ae2dc1e9ad7639e61b5471aa9ce270137960
2022-06-20 12:09:02 +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
jenkins-bot cb17181fa4 Merge "Prefer late static binding over self::" 2022-06-09 16:29:48 +00:00
Ed Sanders af54bae2ec Prefer late static binding over self::
While in many cases the class will never be sub-classed, it's easier
just to always use static:: and not worry about predicting which
classes might have problems in the future.

Change-Id: I23072a1701b5acf62bb3379a877de97627d8fcf3
2022-06-09 15:12:48 +01:00
jenkins-bot 636ff45a75 Merge "TagHooks: Make static method for obtaining DiscussionTools tags" 2022-06-08 11:18:42 +00:00
na1307 edb276e047
Show createpage preference only when feature is available
Bug: T310053
Change-Id: I13262ecbe2d2c45c0ffb8706da17bc806ab2a5b7
2022-06-07 18:59:15 +09:00
jenkins-bot b6abc80c35 Merge "Add preference for offering new topic tool when creating new talk pages" 2022-06-06 23:01:40 +00:00
Ed Sanders ab05e4e24f Add test coverage for ApiDiscussionToolsPageInfo::getThreadItemsHtml
Change-Id: I46a58f6a2ec5f0e1b750c67e85d27081f5fab544
2022-06-06 18:40:30 +01:00
David Lynch b4f829e5ca PageInfo threaditemshtml: include content before the first heading
Fake a placeholder heading for this, unless the first heading is already
a placeholder.

Bug: T304856
Change-Id: Icc12712f77e0c14139b289bec8cc3e0cb4834a43
2022-06-06 18:39:22 +01:00
David Lynch f668ee4989 PageInfo threaditemshtml: For empty headings, include their non-reply content
Bug: T304856
Change-Id: Ifbb7a843ce8a7d52a1b51d9fe16869e2f3ccbf1b
2022-06-06 18:37:59 +01:00
Bartosz Dziewoński e0f231b892 Add preference for offering new topic tool when creating new talk pages
Depends-On: I46a8eaf331e86de0c8c94f0f60bdc4b5be6dd83a
Bug: T297990
Change-Id: Iaf6677affe5d0b7f6047bce55c0a575286c8e676
2022-06-06 17:09:50 +00:00
Kosta Harlan bf161db768
TagHooks: Make static method for obtaining DiscussionTools tags
Bug: T309839
Change-Id: I30697ca56d4aa346151c4d31850f545d32399305
2022-06-03 12:46:16 +02:00
jenkins-bot f460ce39bc Merge "Add attributes for Minerva click tracking" 2022-06-02 15:29:50 +00:00
Bartosz Dziewoński 02ced052db Disable (instead of hiding) preferences that would have no effect
Keeping them visible avoid the page shifting unpleasantly,
and makes it easier to find the option you're looking for.

Change-Id: I1e37d5d11c5a19beb799346f4e9842e836224d3a
2022-06-01 21:36:30 +02:00