wikimedia-gadgets / afc-helper

A tool for reviewing Articles for Creation submissions on the English Wikipedia
https://en.wikipedia.org/wiki/Wikipedia:AFCH
GNU General Public License v3.0
36 stars 80 forks source link

Auto subscribe user to user talk sections #258

Closed NovemLinguae closed 7 months ago

NovemLinguae commented 1 year ago

Requested by Asilvering at https://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Articles_for_creation#Helper_script%3A_Add_an_option_to_disable_watchlisting_user_talk_pages

DiscussionTools has a nifty heading subscription feature, where you can click a [subscribe] feature on the top right of a heading, and then if anyone replies, you get notified in your notification tray. The benefit is that you don't have to watchlist entire pages when you just want to watch one section of a page.

Anyway, look into having AFCH auto subscribe the reviewer to user talk sections that AFCH creates. In case the new user replies and doesn't ping / doesn't know how to ping.

Implement this using the discussiontoolssubscribe API?

Discussiontoolssubscribe API is marked as internal. See also: https://phabricator.wikimedia.org/T329474

IngenuityWP commented 1 year ago

This doesn't seem too difficult to implement, and this is a feature I've wanted for a while, so I'll try to work on this soon. Looks like after the user talk page is saved, the script should make a query to action=discussiontoolspageinfo, and use the data to subscribe to the thread. Should this also be included as an option in the AFCH preferences, so people can disable it if they don't want to be subscribed?

primefac commented 1 year ago

Definitely should be toggle-able; while I see this as a useful feature, I personally don't think I would use it.

MPGuy2824 commented 1 year ago

This doesn't seem too difficult to implement, and this is a feature I've wanted for a while, so I'll try to work on this soon. Looks like after the user talk page is saved, the script should make a query to action=discussiontoolspageinfo, and use the data to subscribe to the thread. Should this also be included as an option in the AFCH preferences, so people can disable it if they don't want to be subscribed?

Or you could eliminate two steps and use https://www.mediawiki.org/w/api.php?action=help&modules=discussiontoolsedit directly

siddharthvp commented 1 year ago

Or you could eliminate two steps and use mediawiki.org/w/api.php?action=help&modules=discussiontoolsedit directly

I'd rather not use discussiontoolsedit as posting to the user talk page is a critical function for which it's better to use the stable and longstanding core API (to which any breaking changes will be well-advertised) instead of an internal API. While discussiontoolssubscribe is also internal, it's only use will be for an optional enhancement.

NovemLinguae commented 7 months ago

Example API payload, with the "token" cropped out.

commentname is in the format h-FirstCommentUsername-FirstCommentTimestamp. Username spaces are converted to underscores.

image

image

NovemLinguae commented 7 months ago

Probably safest to use the discussiontoolspageinfo API to get the perfectly formatted commentname. We can iterate from the bottom up until we find a section starting with "h-". That's the section we just posted and the section that we need to subscribe to.

image