Page MenuHomePhabricator

Support filtering by page creation date in Nuke
Closed, ResolvedPublic3 Estimated Story Points

Assigned To
Authored By
Samwalton9-WMF
Oct 29 2024, 1:17 PM
Referenced Files
F58150291: Screenshot 2025-01-08 at 21.25.24.png
Jan 9 2025, 3:26 AM
F58139521: Group 8.png
Jan 7 2025, 5:18 PM
F58065684: Screenshot_6.png
Dec 27 2024, 3:55 AM
F58065682: Screenshot_5.png
Dec 27 2024, 3:55 AM
F58028789: Screenshot 2024-12-18 at 17.27.01.png
Dec 18 2024, 11:27 PM
F58028786: Screenshot 2024-12-18 at 17.20.14.png
Dec 18 2024, 11:25 PM
F58028782: Screenshot 2024-12-18 at 17.18.18.png
Dec 18 2024, 11:25 PM
F58024107: Error message.png
Dec 16 2024, 4:16 PM

Description

Administrators would like to be able to filter the list of pages in Nuke by the date they were created, for example only listing article created between 1 March 2024 and 1 October 2024. This could be an additional available filter.

We should provide start date and end date filters, and validate that both are within the bounds permitted by $wgNukeMaxAge. If either start or end date are outside of this range, we should display an error message:
"This tool can only delete pages if they were created within the last $wgNukeMaxAge days. Please adjust the date filters so that both dates are within this range"

Design mockups

Figma

Date filterSelecting dateError message when dates are out of range
Date.png (1×1 px, 62 KB)
Selecting date.png (1×1 px, 90 KB)
Filters.png (1×1 px, 73 KB)
  • Date filter with 2 fields "From date" and "To date".
  • Clicking on the input field displays a date picker.
  • Error message is displayed when dates selected are out of range
    • Copy: "This tool can only delete pages if they were created within the last $wgNukeMaxAge days. Please adjust the date filters so that both dates are within this range."
  • "From date" should default to today's date minus $wgNukeMaxAge.

Details

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This would make a lot more sense if we move to the Revision table (T33858), since users could currently only do this filtering within the 30 day RecentChanges window.

We should wait until $wgNukeMaxAge has been increased before prioritising this - it's not so useful when there's only a 30-day window to filter within.

Samwalton9-WMF added a project: Design.
Samwalton9-WMF added a subscriber: OTichonova.

@OTichonova (with apologies for sending more tasks your way) could you quickly mock up adding start and end date selectors to Nuke?

I'm realising we may want to annotate $wgNukeMaxAge somewhere on the Nuke view too, since its value is specifically relevant here.

Samwalton9-WMF set the point value for this task to 3.

We should wait until $wgNukeMaxAge has been increased before prioritising this - it's not so useful when there's only a 30-day window to filter within.

I think we can disregard this previous idea, it's fine to get this in sooner.

Chlod changed the task status from Open to In Progress.Dec 16 2024, 11:50 AM
Chlod moved this task from Ready to Eng review on the Moderator-Tools-Team (Kanban) board.

Change #1104659 had a related patch set uploaded (by Chlod Alejandro; author: Chlod Alejandro):

[mediawiki/extensions/Nuke@master] Support filtering by page creation date

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

Is the validation warning appearing below the "from" and "to" dates a hard requirement? It'd be easier to show the warnings as part of the boxes as seen in T380297, but I understand if this isn't something that we should go for.

Minor note that since the Special:Nuke form currently doesn't use HTMLForm in its full capacity right now, trying to get anything validation-related to appear without having to duplicate code is a bit of an issue. I ran into this same issue trying to implement T380297. I'd love to spend some time trying to fix that, but that's some extra refactoring code, and it may not be as worth it when the Codex redesign is just around the corner.

Is the validation warning appearing below the "from" and "to" dates a hard requirement? It'd be easier to show the warnings as part of the boxes as seen in T380297, but I understand if this isn't something that we should go for.

Hi @Chlod, that would work as well. It was originally in-line because the message pertains to the date itself.

Error message
Error message.png (1×1 px, 73 KB)

Something I'm noticing with SpecialNuke.php is a great lack of expandability for the getNewPages function, whose signature keeps changing whenever we add new filters. It'd probably be a good idea to refactor it to take in a single filter object instead of multiple filter parameters, especially if there's plans (or not) to add more filters in the future. I'll probably do that work as part of the work to change up the form to use Codex (T153988).

Anyways, this should be ready for review soon. Just making some final polishes before sending to engineering review.

Test wiki created on Patch demo by SCardenas (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/2435fdf6ab/w/

Thanks for working on this, Chlod! I have a couple of comments UI-wise. While clicking around the UI, I noticed the error message when you input an incorrect date is not showing. I know it is not optimal to have duplicated code with Codex around the corner, but the validation messages are needed to provide context.

Screenshot 2024-12-18 at 17.18.18.png (547×975 px, 53 KB)

I also see that the From date field does not default to $today-$wgNukeMaxAge. This should be changed.

Screenshot 2024-12-18 at 17.20.14.png (303×352 px, 25 KB)

Further code review in the Gerrit CR.

It looks like the error message shows on the confirmation page, even if you didn't input an invalid date.

Screenshot 2024-12-18 at 17.27.01.png (326×963 px, 32 KB)

It looks like the error message shows on the confirmation page, even if you didn't input an invalid date.

Screenshot 2024-12-18 at 17.27.01.png (326×963 px, 32 KB)

Looks like this is coming from wpDeleteReasonList not having a default value. I've set it to default to "Other reason".

I've resolved some of the comments on the patch, and left other comments, but I'm still working on getting the field validation to display properly, as discussed in the check-in.

Thanks for working on this, Chlod! I have a couple of comments UI-wise. While clicking around the UI, I noticed the error message when you input an incorrect date is not showing. I know it is not optimal to have duplicated code with Codex around the corner, but the validation messages are needed to provide context.

Screenshot 2024-12-18 at 17.18.18.png (547×975 px, 53 KB)

Still looking for a way to get this done. Hoping to find out how by the end of this Friday but it's not looking likely, unfortunately, barring something really useful that I stumble upon.

I also see that the From date field does not default to $today-$wgNukeMaxAge. This should be changed.

Missed this from the task description. Fixed! Thanks for pointing it out.

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

http://patchdemo.wmcloud.org/wikis/2435fdf6ab/w/

Test wiki created on Patch demo by SCardenas (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/970c139b2e/w/

I've added in client-side validation for the date fields, which was more work than I expected, since HTMLForm doesn't seem to make it easy. This also means the error messages appear alongside the input, as originally designed. The downside is that it doesn't look that nice.

Screenshot_5.png (188×732 px, 6 KB)

And it's particularly worse when both fields are invalid.

Screenshot_6.png (187×700 px, 8 KB)

Maybe the message should be shortened? Or we could have these inputs be on their own lines instead, though arguably that also doesn't look that nice.

Noting here that the patch is ready for engineering review, but the issue above with the validation messages remains unresolved. Moving this to design review so that we know where this task is at the next meeting.

Also noting here that I've broken the patch for this task up into multiple patches: one for the validation message tests, another for adding in a context object to cut down on changing method signatures (see commit message of patch), another for a function that allows backdating page creations in tests, and the actual addition of the page creation filters. The rationale behind this is so that I can work on the Codex form with the new date filters and other helpful tests and utilities, without falling into merge conflict hell if this patch happens to get merged first, especially since feedback won't be rapid until the year turns over.

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

http://patchdemo.wmcloud.org/wikis/970c139b2e/w/

Thanks @Chlod

Maybe the message should be shortened? Or we could have these inputs be on their own lines instead, though arguably that also doesn't look that nice.

I think keeping under each input is fine.
Makes sense to try to make it shorter. Maybe something like "Only pages created in the last 7 days can be deleted. Please change the date so it is within the range."

Group 8.png (187×700 px, 10 KB)

Thanks Olga! I've applied the new message in the latest patchset.

I have been playing around with the patch, and I can't trigger the error for the To Date field, even when I set a date way into the future.

Screenshot 2025-01-08 at 21.25.24.png (164×714 px, 21 KB)

I am seeing the same behavior in the Patch Demo I just created.

I have a question for @OTichonova: What do you think about adding a default date in the To Date field? I think it would look better if both date fields have defaults and it would also tell the user what the date limits are at a glance.

Test wiki created on Patch demo by SCardenas (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/e8af421dc6/w/

I didn't add a check to ensure that the "to date" goes far in the future as an application of Postel's law. The date filters for Special:Contributions also works the same way, allowing dates that are in the future (and even far in the past, but in our case we're restricting that date) rather than returning an error. In any case, no revisions will ever be dated in the future, so this will always return up to the current time (or for "from date", always return nothing).

If this is something that should throw a hard error, then I can also add that check in, but there may be UX implications (users trying to put in "just any date in the future so that it gets everything up until now" being met with an error instead of usable results).

Change #1104659 merged by jenkins-bot:

[mediawiki/extensions/Nuke@master] Support filtering by page creation date

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

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

http://patchdemo.wmcloud.org/wikis/e8af421dc6/w/

jsn.sherman subscribed.

verified working on testwiki; leaving open until train rolls out