Page MenuHomePhabricator

Show "associated talk page has N subpages" warning when deleting the subject page
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

A common practice on WMF wikis is to archive talk pages as subpages. For instance see https://en.wikipedia.org/wiki/Special:PrefixIndex/Talk:Polar_bear/. Conveniently, MediaWiki let's you know if you are about to delete a page with subpages, so that you don't forget to delete those subpages, too (it does not let you mass-delete all of those subpages, though, that's tracked at T15491). With the new "delete associated talk page" checkbox, we never need to browse to the talk page. Thus the problem is that we aren't notified that the talk page has subpages, so the admin may not know they need to delete them.

Acceptance criteria

  • When deleting a subject page that has a talk page with subpages, I should be shown a message like "The associated talk page has N subpages" warning, similar to the "The page you are about to delete has N subpages" warning shown currently when deleting the talk page directly.
  • The warning message should be shown or hidden depending on the status of the Delete associated talk page checkbox

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptApr 1 2022, 7:00 PM

So we want to show the warning when the user selects the checkbox or on submit with a confirm checkbox afterwards (Like what Blocks do when you block yourself)

So we want to show the warning when the user selects the checkbox or on submit with a confirm checkbox afterwards (Like what Blocks do when you block yourself)

We don't usually do JS-based conditional messaging for Core workflows, so I was thinking we'd just always show the message when the talk page has subpages. Many communities differ, but I believe the prevailing convention is you'd almost always want to delete the talk page with the subject page, so I think it makes sense to show the warning upfront. The query should be somewhat fast because it only checks for a maximum of 50 subpages, I believe.

Confirmation after submission is another approach, but it slows down the workflow (2 clicks to delete instead of 1). Another alternative would be to show the warning after submission, as the next logical step would be to delete all the subpages. However this makes the assumption the presence of subpages won't influence the admin's decision to delete, so all in all, I'm still thinking showing the warning upfront is best. If we can conditionally show/hide the message with JS, that would be ideal, but I don't think it's a big deal if we can't.

I suggest handling it the same way Special:MovePage does.

I suggest handling it the same way Special:MovePage does.

I almost think that doing what MovePage does is the proper solution but it is a bit outside the scope of the wish. It is also worth noting that DeleteAction currently does not delete subpages nor warns about them and that should probably change too.

We don't usually do JS-based conditional messaging for Core workflows, so I was thinking we'd just always show the message when the talk page has subpages. Many communities differ, but I believe the prevailing convention is you'd almost always want to delete the talk page with the subject page, so I think it makes sense to show the warning upfront. The query should be somewhat fast because it only checks for a maximum of 50 subpages, I believe.

Confirmation after submission is another approach, but it slows down the workflow (2 clicks to delete instead of 1). Another alternative would be to show the warning after submission, as the next logical step would be to delete all the subpages. However this makes the assumption the presence of subpages won't influence the admin's decision to delete, so all in all, I'm still thinking showing the warning upfront is best. If we can conditionally show/hide the message with JS, that would be ideal, but I don't think it's a big deal if we can't.

It should not be a problem to hide/show the message with JS. And there is already pre-existing code that checks for subpages so it should not be complicated.

I suggest handling it the same way Special:MovePage does.

I almost think that doing what MovePage does is the proper solution but it is a bit outside the scope of the wish. It is also worth noting that DeleteAction currently does not delete subpages nor warns about them and that should probably change too.

I only meant about how/when it shows the number of talk subpages message (upfront regardless of checkbox state, IIRC), not changing the actions performed.

I think showing the message regardless of the checkbox state would work. If we don't want to clutter the interface with one more warning, perhaps it could be added to the existing warning about subpages, i.e. (additions in bold):

Warning: The page you are about to delete has $1 subpages, and its talk page has $2.

I think showing the message regardless of the checkbox state would work. If we don't want to clutter the interface with one more warning, perhaps it could be added to the existing warning about subpages, i.e. (additions in bold):

Warning: The page you are about to delete has $1 subpages, and its talk page has $2.

I'll start with this. We can hide/show in a later patch if we decide to

Change 789853 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/core@master] [WIP]

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

I think showing the message regardless of the checkbox state would work. If we don't want to clutter the interface with one more warning, perhaps it could be added to the existing warning about subpages, i.e. (additions in bold):

Warning: The page you are about to delete has $1 subpages, and its talk page has $2.

I'll start with this. We can hide/show in a later patch if we decide to

@dmaza Testing your patch, I only get the The associated talk page of the page you are about to delete has x subpages. warning

image.png (558ร—824 px, 35 KB)

even though in this example, Page 59 has a subpage

image.png (423ร—750 px, 22 KB)

which when compared to a similar example on test.wiki

image.png (625ร—802 px, 43 KB)

seems like its missing a warning?


Is this expected behaviour? ๐Ÿ˜ธ

Test wiki created on Patch demo by DMaza (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/72183b4a35/w/

I think showing the message regardless of the checkbox state would work. If we don't want to clutter the interface with one more warning, perhaps it could be added to the existing warning about subpages, i.e. (additions in bold):

Warning: The page you are about to delete has $1 subpages, and its talk page has $2.

I'll start with this. We can hide/show in a later patch if we decide to

Is this expected behaviour? ๐Ÿ˜ธ

Discussed on slack, related to a $wgNamespacesWithSubpages config change โ€” not unexpected behaviour for this change then :)

Discussed on slack, related to a $wgNamespacesWithSubpages config change โ€” not unexpected behaviour for this change then :)

A bit unexpected in my opinion. But nothing I changed. Not sure if I need to fix something here

Change 789853 merged by jenkins-bot:

[mediawiki/core@master] DeletePage: Show warning when assoc talk page has subpages

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

Discussed on slack, related to a $wgNamespacesWithSubpages config change โ€” not unexpected behaviour for this change then :)

A bit unexpected in my opinion. But nothing I changed. Not sure if I need to fix something here

$wgNamespacesWithSubpages[NS_MAIN] is not set by default in MediaWiki. I believe the idea is that users will likely have content pages that contain slashes in the title but shouldn't be treated as subpages. I.e. https://en.wikipedia.org/wiki/AC and https://en.wikipedia.org/wiki/AC/DC. So anyways, no issue here :) The patch works great in my testing and is now ready for QA.

@dmaza Is this supposed to work for Files as well (File_talk pages by default can have subpages)?

@dmaza I wonder if the link to Special:PrefixIndex for the associated talk page should end in a /. This is what we do with the link to the page's own subpages.

For example, this page currently has a link to Special:PrefixIndex/Help_talk:Cite_errors. Perhaps it should be Special:PrefixIndex/Help_talk:Cite_errors/.

The latter would mean we wouldn't include the page Help_talk:Cite_errors itself nor any pages which happen to start Help_talk:Cite_errors but are not subpages.

@dmaza I wonder if the link to Special:PrefixIndex for the associated talk page should end in a /. This is what we do with the link to the page's own subpages.

For example, this page currently has a link to Special:PrefixIndex/Help_talk:Cite_errors. Perhaps it should be Special:PrefixIndex/Help_talk:Cite_errors/.

The latter would mean we wouldn't include the page Help_talk:Cite_errors itself nor any pages which happen to start Help_talk:Cite_errors but are not subpages.

Good point. I'll change it

@dmaza Is this supposed to work for Files as well (File_talk pages by default can have subpages)?

I would say so. Let me look into it

Change 792629 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/core@master] DeleteAction: Show warning when subpages are present

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

@dmaza Is this supposed to work for Files as well (File_talk pages by default can have subpages)?

I would say so. Let me look into it

Thanks. I am going to move this back into Review for visibility.

Change 792629 merged by jenkins-bot:

[mediawiki/core@master] DeleteAction: Show warning when subpages are present

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

Here is an example of the warning you get:

subpage_warning.png (250ร—981 px, 56 KB)

I have tested this for several different namespaces, including Files.

Example pages to test:

Test environment: local and https://en.wikipedia.beta.wmflabs.org

Test wiki on Patch demo by DMaza (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/72183b4a35/w/