Commit graph

82 commits

Author SHA1 Message Date
David Lynch 71d2e76d7f Update a/b test code for visual enhancements a/b test
Strip it out from applying to logged out users and make the test work
for multiple features

Bug: T333715
Change-Id: Id15a8a99c2ea8e6fc14fc83baf2ed6ebaaf754c8
2023-05-08 01:30:21 -05:00
Bartosz Dziewoński 316e741868 Support topic subscriptions when JavaScript is disabled
Unsubscribing was already available from Special:TopicSubscriptions
when JavaScript is disabled.

* Add links to subscribe/unsubscribe in CommentFormatter
* Update links in skin navigation
* Add support for subscribing in the actions

Bug: T321431
Change-Id: If3c4bf7df309d0d98237c3b7b9c129cc2f72cda3
2023-04-10 21:30:19 +02:00
Bartosz Dziewoński 6a7d949703 Remove integration with removed MobileFrontend talk page tools
* Remove the hook we used to disable that feature
* Remove CSS that only applied when it was enabled
* Update code comments that referred to it

Bug: T319145
Change-Id: If21a04f6a087289d8249a786f7c991e5e12c9bed
2023-04-04 17:17:49 +02:00
Ed Sanders e6a255215f Add new topics subscription button in Minerva
Bug: T332730
Change-Id: Ib6915319eeae4aa32c875decd51e7fd8db4dbd16
2023-03-27 23:28:38 +01:00
jenkins-bot 7106233d59 Merge "Only show the mobile add topic button on view pages" 2023-03-24 00:37:12 +00:00
David Lynch 0cf9c41b18 Only show the mobile add topic button on view pages
Bug: T332897
Change-Id: Id63c391a286356d9007f9a7a0b6eec75747ee6c3
2023-03-23 10:19:10 -05:00
Ed Sanders 80dd6e2d7c Add new topic subscription button to page actions
Bug: T263821
Change-Id: Iab7f7d5fd1f7c229c2e0cda9369676cfd401a24e
2023-03-20 14:51:10 +00:00
Bartosz Dziewoński 5d3d3cf687 Use setExtensionData() instead of marker comments where possible (2/3)
We started using marker comments (HTML comments with special content
inserted into the page) for the reply buttons back in the day, because
we needed to indicate their location in the HTML. Later we used the
same idea for things which aren't actually tied to a specific location
in the HTML, such as boolean data like __DTEMPTYTALKPAGE__. There is a
better way to do this.

This commit starts reading from ParserOutput::getExtensionData(),
which was generated by the previous commit, and should be present
in all cached ParserOutput objects by the time we merge this.

Bug: T328980
Change-Id: I9f7a907836b86f25567fd4b352464d62d76e20e4
(cherry picked from commit 0ac420ecbc)
2023-02-11 21:16:03 -06:00
DLynch fb08abe062 Revert "Use setExtensionData() instead of marker comments where possible (2/3)"
This reverts commit 0ac420ecbc.

Reason for revert: this was supposed to be merged later; revert it now and reapply in a bit

Change-Id: I33fb07856152c2401b3a071c143f27f1e9753287
2023-02-12 02:57:31 +00:00
Bartosz Dziewoński 0ac420ecbc Use setExtensionData() instead of marker comments where possible (2/3)
We started using marker comments (HTML comments with special content
inserted into the page) for the reply buttons back in the day, because
we needed to indicate their location in the HTML. Later we used the
same idea for things which aren't actually tied to a specific location
in the HTML, such as boolean data like __DTEMPTYTALKPAGE__. There is a
better way to do this.

This commit starts reading from ParserOutput::getExtensionData(),
which was generated by the previous commit, and should be present
in all cached ParserOutput objects by the time we merge this.

Bug: T328980
Change-Id: I4bf81ef3fd904f4d920d0756370c9bfa0a10a774
2023-02-11 19:33:20 +00:00
Bartosz Dziewoński fce317ace4 Move TOC metadata generation to a post-processing step
Instead of generating the TOC HTML additions immediately, store
the data we need using ParserOutput::setExtensionData(), and use
the OutputPageParserOutput hook to fetch it and generate the HTML.

We check that the stored data is present before using it to avoid
issues with cached ParserOutput objects.

Bug: T328122
Change-Id: I7d4988cd568f10b7995a4d744e0ec6e7ce081b0e
2023-02-07 02:39:11 +01:00
Bartosz Dziewoński af7097f02f Enable collapsible content in mobile talk page lede content
Bug: T323639
Change-Id: I3cfc8e7337172b44156a7f3bed9ff134c0851475
2023-01-03 18:16:15 +00:00
David Lynch c706562ce9 VisualEnhancements: in some languages put an arrow by the reply button
New config: DiscussionTools_visualenhancements_reply_icon_languages

Config is set up with a provide_default merge strategy so we can remove
items from it quickly if need be.

Bug: T323537
Change-Id: Ib748897a2162bb233000f7364e30b268932f4c4a
2022-12-13 00:11:08 -06:00
Ed Sanders c2dc05b085 Add 'collapsible-headings-collapsed' body class
Used by MobileFrontend in I78cfb22fbe7d to prevent sections from
auto-expanding.

Bug: T321618
Bug: T322628
Change-Id: I6dafd5b9cb170bfa57f185849db6450162173399
2022-12-07 16:51:22 +00:00
jenkins-bot 984f804f17 Merge "Don't collapse the lede section when it has comments" 2022-12-05 19:04:37 +00:00
jenkins-bot 8a6bc91f46 Merge "Consider MediaWiki:Talkpageheader message when adding "Learn more" button" 2022-12-05 19:04:35 +00:00
Bartosz Dziewoński b4475801fd Don't collapse the lede section when it has comments
Bug: T324139
Change-Id: I14e1dae0fef4177f5a6a223bc9b663e99c9f741c
2022-11-30 20:25:22 +01:00
Bartosz Dziewoński e72f58ca78 Remove some redundant PHPDoc comments
Inspired by this Wikitech-l discussion:
https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/NWXPNHRNLEVXHSWX33H473OAWQP6CDOA/

To keep this simple for now, I am only removing redundant PHPDoc
comments on constructors, and only when all the documentation for
parameters completely duplicates type hints.

More could be done, but that can happen later when we have better
tooling. Redundant comments on constructors that take a dozen services
are by far the most annoying for me and I want them gone now.

Change-Id: I86cbf7d6e48035cfa06f780c8fb1b02e68709a0c
2022-11-29 18:47:18 +00:00
Bartosz Dziewoński 74fbe19838 Consider MediaWiki:Talkpageheader message when adding "Learn more" button
We also need to move the code to the other hook to avoid adding it twice now.

Bug: T324046
Change-Id: I186d15f6e6537b47b019c9707d7ae8ef080f4ae2
2022-11-29 18:46:40 +00:00
Bartosz Dziewoński 8452f94cf9 Use 'BeforePageDisplay' instead of 'OutputPageBeforeHTML' for once-per-page things
Also fix a CSS selector to handle content added in multiple
'OutputPageBeforeHTML' hook calls.

Bug: T323376
Bug: T323833
Change-Id: I480d9bf544d61f0cb7bfd04cadfbf053e7e1b70e
2022-11-25 16:12:16 +00:00
Bartosz Dziewoński e0be640c35 Don't add lede button if mobile DiscussionTools not enabled
Bug: T323341
Change-Id: I60d93a3e72918d303a45b2a75f4fa549aea8d917
2022-11-18 15:55:54 +01:00
David Lynch 714830f615 Don't run OutputPageBeforeHTML for the talkpageheader
Ideally this would just not run the hook for any interface messages, but
that condition isn't obviously available.

Bug: T316175
Change-Id: Ibd354eb7a0fb7a316dcbf09e64b80f2d9b4008c8
2022-11-17 21:15:51 -06:00
Ed Sanders b132522fa9 Make "Add topic" button sticky
Bug: T316175
Change-Id: Ie5198e902ec3fa7a7eba56cef6c6f0ef71ef7314
2022-11-16 12:23:34 +00:00
Ed Sanders 79521f89cf Add button to reveal lede section on mobile
Bug: T312309
Depends-On: I9c3035c9dbe7545a05efb2286dffe0145d3557b4
Change-Id: I9d74914ddbcc9def74e85106a68574a807b0b731
2022-11-10 22:10:04 +00:00
jenkins-bot c0e757c716 Merge "ABtest for mobile, logged out users" 2022-11-08 18:41:38 +00:00
David Lynch 9021a45966 ABtest for mobile, logged out users
Bug: T320993
Change-Id: I3530c540ec20f8806abcd7010b4d4933d1b53cfc
2022-10-31 16:23:59 -05:00
Bartosz Dziewoński 433e57394c Use PHP 7.4 property types
Change-Id: I788db64f0c0c00894d77256b7f016d44eda4bbb1
2022-10-28 21:56:38 +02:00
jenkins-bot 3436684b2c Merge "Only hold on to a Config instead of ConfigFactory when injecting" 2022-09-28 14:22:46 +00:00
Thiemo Kreuz 62ddb8bceb Use cheaper getRawVal/getCheck instead of getVal where possible
getVal/getText can be expensive because they do Unicode normalization.
We can skip this when we know we aren't going to do anything meaningful
with the value anyway.

Change-Id: I9d939a44df6b67bcd8429096d89600ce1566ca39
2022-09-03 05:27:20 +00:00
Bartosz Dziewoński 14b01e101a Only hold on to a Config instead of ConfigFactory when injecting
The config is currently unused in some classes, but this is okay since
it might be used in the future.

Change-Id: Ie25fc52cc5d3476c9445e182975d229991316bd3
2022-09-03 00:39:51 +02: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 0868d40cbf Avoid dependency on Minerva for the mobile "Add topic" button label
We might want to delete the code that defines it in the future.

The core message is the same in most translations, and available in
100+ more languages.

Change-Id: I230e051940fdd7b89989453eccbffac804a7ddea
2022-08-02 00:58:14 +02: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
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
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
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
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
Ed Sanders da64c43ccc Show thread metadata in section headers
Bug: T269950
Change-Id: Ifa47ddcbccf288be0bbecd5961eab7c5122aab7b
2022-06-23 17:17:09 +01:00
Bartosz Dziewoński 28124e7f1e Add attributes for Minerva click tracking
Bug: T295490
Change-Id: I05fa96280c8dacc801b071d22086568ee0f11d86
2022-05-27 03:55:09 +02:00
David Lynch b6f554a945 Ready A/B test code for topic subscriptions
Topic subscription test is going to be all logged in users only, no
transitory enrollment conditions, so we can remove the anonymous user
handling and DB writes.

Bug: T302515
Bug: T304030
Change-Id: I5e57bb9b7958576f3a04373748331a86f4626fb5
2022-05-19 01:09:40 -05:00
Ed Sanders 91446d790e Empty state: Use self closing Html generators
Change-Id: I5352b064ac9e71df9f3f8791139944126b321436
2022-04-08 18:30:48 +01:00
Reedy 400d6227b8 Use namespaced VisualEditor traits and classes
Change-Id: I06eefd96068675607ed66a8a307d86c24d21f916
2022-03-29 20:32:44 +01:00
Bartosz Dziewoński 109f49bb56 Mobile: Only show "Add discussion" button if "New section" tab would be shown on desktop
Bug: T302417
Change-Id: Icd2acf19b8b7e4cf8893bbb37f80eafefe86acbb
2022-02-23 18:05:01 +01:00
C. Scott Ananian fe35a7324c Replace use of deprecated OutputPage::enableClientCache( false )
Replaced with the more readable ::disableClientCache() method, added
in 1.38.  Minimum MW version for this extension is already at 1.38.

Depends-On: I7c89e20528a0d91173f0edcb997dcae631935ee5
Change-Id: Idf1cf2fac3311f50ed3cbc420f7772b5c71b1992
2022-02-04 14:30:33 -05:00
jenkins-bot 6c5461d858 Merge "Treat user talk subpages like normal talk pages in empty state text" 2022-01-12 17:04:21 +00:00
jenkins-bot ecd649f6e2 Merge "Allow logged out users to be enrolled in the A/B test" 2022-01-12 01:58:50 +00:00
David Lynch 2f1e2f80e0 Allow logged out users to be enrolled in the A/B test
For logged out users we store their test state and an anonymous
identifier in local storage. So long as the test is enabled, we include
these in any logging that occurs.

This is done entirely client-side, to avoid any cache issues caused by
state depending on cookies from PHP for logged out users.

Bug: T291307
Change-Id: Ib39e2f2146cdfdac9df5690ee3de75718f0f2731
2022-01-10 18:10:50 -06:00
Bartosz Dziewoński d0dd6b3f73 Treat user talk subpages like normal talk pages in empty state text
Bug: T298454
Change-Id: I0b95f87fe934dcb7d233265b0a41956ed8f3c143
2022-01-03 16:36:08 +01:00