Commit graph

92 commits

Author SHA1 Message Date
Ed Sanders 81e690df8c Distinguish between MobileFrontend and Minerva
Change-Id: I7490190a6ddd3def502335b6dc2ec0d39477256b
2023-10-13 14:39:17 +01:00
Ed Sanders 4447b6d201 Always pass whole OutputPage (as IContextSource) to postprocess functions
Change-Id: I07b312b8c00f9b5d20e285874ed0a0153949dd18
2023-10-09 15:41:28 +01:00
Kosta Harlan c6c7dd2fb0 overflow menu: Add hooks for registering and interacting with items
Why:

- We want to allow extensions to register interactive menu items in the
  overflow menu.

What:

- Create a PHP hook to allow extensions to provide menu items
  for rendering in the overflow menu
  - The hook allows for registering resource loader modules required by
    the menu item
  - The hook passes in some contextual information, like the thread
    item data, context source object, and if the page is editable
- Create a JS hook that fires when a user selects one of the menu items
- Example implementation: Ie9afbedb4f24cbd75eb48bb21dc9f6d8d732d853

Misc:

- Remove b/c code that existed to handle a transitional period where
  JSON encoded overflow menu data did not necessarily exist in the
  parser cache
- Rename code instances of ellipsis button / data / menu to refer to
  "overflow menu"
  - Some renames will have to wait until parser cache is updated; these
    are noted with TODOs

Bug: T342251
Change-Id: I5f2a51791f8ba7619d1399a4b93111e9bb44e172
2023-10-05 15:50:33 +01:00
Ed Sanders 7dff37e354 Show new topics subscription button on history pages
Bug: T345096
Change-Id: I5da6ac0bca900f9fe3482d247d20aaf24feb61f2
2023-08-28 19:54:56 +01:00
Umherirrender fd0de6b09a Use namespaced Title
Bug: T321681
Change-Id: I66a498679d0743b7740887c636eca001efc170cd
2023-08-19 20:16:15 +02:00
Ed Sanders e389fc48f1 Always use === in PHP
Change-Id: I30ca7cdf73921dcae48997841816099972cdbed0
2023-07-26 14:29:40 +01:00
Bartosz Dziewoński fda08f7b54 Remove the new topic tool hint
This temporary message has been shown for long enough.

This mostly reverts:
* d0eec56f6d
* f24a73a05a
* bd40523843

Bug: T322495
Change-Id: Ic1762e170547fba8b5fda225eff21e515ace512d
2023-05-24 20:15:49 +02:00
thiemowmde 8bbbf39bbd Make use of named MainConfigNames::… constants
Also merge setMwGlobals() calls because they are really expensive.

Also utilize the more readable str_contains() and related.

Change-Id: Iebde6aa17c2e366f0c0a98fe13a454f6a06c299b
2023-05-19 12:12:32 +02:00
jenkins-bot 25b3366070 Merge "Add talk page empty state for temporary accounts' user talk pages" 2023-05-16 17:51:54 +00:00
Bartosz Dziewoński e3441be186 Add talk page empty state for temporary accounts' user talk pages
Depends-On: I2ea656a8a1704a495f1a94fede1a8829ba7325a1
Bug: T335590
Change-Id: Ibe1ea316f5da450b4478bf466ec12bbca9a91cd2
2023-05-16 17:00:03 +00:00
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