-
Notifications
You must be signed in to change notification settings - Fork 823
add empty spam button and endpoint #44308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 2 files.
1 file is newly checked for coverage.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
Thanks for working on it! "Empty spam" should work little differently from "Empty trash"; instead we should move the entire spam folder contents into trash in this case, just like for individual items: ![]() Because the action isn't as destructive, we wouldn't need the confirmation either. If we returned the list of IDs "trashed" from the API (and in cases where it isn't a ton of IDs) we could then provide "undo" action in the confirmation like we do for individual items, but I don't think that's a biggie to also leave out if it's complicated: ![]() cc @ilonagl for thoughts. |
Thanks for the review and clarification @simison Though I first imagined the "Empty spam" to work as you mention, I then thought it'd make sense to just delete all spam, since the button is in the same position as "Empty trash" and messages marked as spam are there to be reviewed (in case the user wants to double check) but then there's no use for them. Since the user is already on that screen, means he's reviewed them and the button offers to just "purge" them. Then again, it would also feel natural that responses have a flow of "going right" (from inbox to spam, from spam to trash, then actual deletion from there), so actions from the spam view (being in the middle) should move things to "right or left", not obliterate them. Both approaches seem fine to me, so if you have a strong opinion I'll just make the change, not a big deal and makes complete sense. |
Fixes FORMS-214
Proposed changes:
This PR adds a "Empty spam" button to delete ALL responses marked as spam, regardless of selection. It works like (it's a copy of) Empty Trash button.
At this point I didn't see the need to overengineer the component into a reusable one, if we find a 3rd or 4th usage for the same request strategy, then we can revisit. Same goes for the endpoint, we're reusing the
/trash
endpoint as the verb and action are the same, seems to me it's fine to share the endpoint based on the status param.Other information:
Jetpack product discussion
FORMS-214
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Visit Jetpack > Forms dashboard on the Spam view. There should be a "Empty spam" button on the top-right corner:
The button will be disabled if there are no responses listed as spam. Clicking the button will open a confirmation dialog:

Cancel should work as expected. Confirming will DELETE all responses marked as spam and the view should refresh to update both the list and the number of responses (on the Inbox status toggle tab)