Page MenuHomePhabricator

[Intervention] Introduce New Topic Notifications (mobile)
Closed, ResolvedPublic

Description

T263821 introduced a way for people using desktop skins to elect to receive notifications when new topics are posted on talk pages they are interested in.

This task involves the work of extending this functionality to people accessing/using talk pages on mobile.

Requirements

For people who

  • 1) Have the Enable topic subscription setting within Special:Preferences#mw-prefsection-editing enabled and
  • 2) Are logged in
  • 3) Are accessing Wikipedia using any of the following skins: Minerva

...the following should be true:

  • 3) When visiting a talk page, a link should appear within the skin's existing ⋮ menu called Subscribe
    • //Note: the ⋮ menu is the menu that includes items like, Page information, Permanent link, What links here, and Move
  • 4). When people click this Subscribe link a toast should appear that reads: You have subscribed! You will receive notifications when new topics are started on this page.
  • 5) The link that read Subscribe in step 3), should now read Unsubscribe
  • 6) Whenever a new topic is published on the page they took "Step 3)" on by someone other than them, they should receive a notification, via Echo, that reads: New topic "TOPIC NAME" started on PAGE TOPIC WAS STARTED ON by USERNAME OF PERSON WHO STARTED TOPIC"
  • 7) When someone clicks an Unsubscribe link a toast should appear that reads: You have unsubscribed. You will no longer receive notifications when new topics are started on this page.
  • 8) Whenever a new topic is published on the page they took "Step 7)" on by someone other than them, they should NOT receive a notification via Echo
NOTE: the state of the Subscribe link this task introduces should NOT have any impact on whether people receive notifications about new comments in topics they are subscribed to manually or automatically.

Open questions

  • 1. What technical approach will we take for adding the new Subscribe item this task is "asking" for to the ⋮ menu? Currently, MobileFrontend does not have a hook that would enable the Editing Team to do so.

References

Event Timeline

  • 3) When visiting a talk page, a link should appear within the skin's existing ⋮ menu called Subscribe

My understanding is that there is currently no hook to add things to this menu on mobile, is that correct @Jdlrobson?

  • 3) When visiting a talk page, a link should appear within the skin's existing ⋮ menu called Subscribe

My understanding is that there is currently no hook to add things to this menu on mobile, is that correct @Jdlrobson?

The ... menu is the equivalent of the Vector toolbox. It should be extensible with mw.util.addPortletLink( 'p-tb' ) ... on the frontend. I'm not sure on state of backend support but it should work with https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation::Universal and if it isn't I'd be happy to help you fix that.

It appears to be built here from a hard-coded list that isn't extended by a hook: https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/404985a9f1e21f89ea360ca3fa9ea2ddf27c1869/includes/Menu/PageActions/DefaultOverflowBuilder.php

It also uses icons, so we'd need to allow those to be defined optionally, if that isn't already possible.

The JS API works but also doesn't support defining an icon. Could probably hack one in if we went down the JS only route, but it would be nicer to fix this properly.

It should be extensible with mw.util.addPortletLink( 'p-tb' ) ... on the frontend.

It looks like it also contains tools from p-cactions (move/delete...), shouldn't it implement that list as well?

Change 902439 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Make toolbox and actions menu more flexible to extension

https://gerrit.wikimedia.org/r/902439

It appears to be built here from a hard-coded list that isn't extended by a hook: https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/404985a9f1e21f89ea360ca3fa9ea2ddf27c1869/includes/Menu/PageActions/DefaultOverflowBuilder.php

Would be great to not make that hardcoded e.g. https://gerrit.wikimedia.org/r/902439 - let's fix that.

The JS API works but also doesn't support defining an icon. Could probably hack one in if we went down the JS only route, but it would be nicer to fix this properly.

It does. You need to provide and id.

mw.util.addPortletLink('p-tb','#','text','myid'); // It will currently create a mw-ui-icon element with class "mw-ui-icon-portletlink-myid"
``

> It looks like it also contains tools from p-cactions (move/delete...), shouldn't it implement that list as well?

We've been trying to retroactively map Minerva's menus to the closest core equivalent to make this sort of thing easier. One of the limitations with Minerva right now is menus are flat but yes ideally there would be two UL elements here with no difference in visual rendering but right now the team's focus is completely on Vector 2022 so a lot of these are ideas in our head we haven't had a chance to implement yet´. On Vector 2022, page actions and toolbox are also in the same menu now so I think this is consistent at least from the UI point of view.

Change 902751 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/DiscussionTools@master] Add new topics subscription button in Minerva

https://gerrit.wikimedia.org/r/902751

Change 902439 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Make toolbox and actions menu more flexible to extension

https://gerrit.wikimedia.org/r/902439

Change 902751 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Add new topics subscription button in Minerva

https://gerrit.wikimedia.org/r/902751