-
Notifications
You must be signed in to change notification settings - Fork 198
Feature: add frontend requirements for trashing donations #8011
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
base: epic/donation-details-admin-page
Are you sure you want to change the base?
Feature: add frontend requirements for trashing donations #8011
Conversation
|
||
try { | ||
await apiFetch({ | ||
path: `give-api/v2/admin/donations/delete?ids=${donationId}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good way to get this working since it already exists - however, we should really be updating our v3 endpoint for delete functionality. Perhaps we can follow up on this UI focused PR with the updated endpoint functionality and swap this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonwaldstein Yea there's also an issue with using wp_delete_post(id, false)
it still deletes the post not trash it. I was eventually able to get it to work with wp_trash_post
but could not pin down why the former would not trash it properly.
try { | ||
await deleteDonation(donation?.id); | ||
setShowConfirmationDialog(null); | ||
window.location.href = `${adminUrl}edit.php?post_type=give_forms&page=give-payment-history`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this full url would be convenient to send through the window something like: donationsAdminUrl
await apiFetch({ | ||
path: `/givewp/v3/donations/${donationId}?force=${force}`, | ||
method: 'DELETE', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discovered we can use deleteEntityRecord here instead of fetch.
It will make a the DELETE request and we would include the force param.
There's a nifty little tutorial here on how to use it but it's pretty similiar to our other entity record usages
Resolves GIVE-2686
Description
This PR adds support for trashihng donations from the Overview page. It introduces a custom hook to handle the API call for deletion using the v3 api. The confirmation dialog opened by the row action "delete" on the DonationListTable has also been updated for parity & to enable trashing rather then permanent deletion.
Note: Can be tested with
feature/v3-donations-support-trash
Affects
Donation Overview page
Deleting Donations
Visuals
Testing Instructions
Pre-review Checklist
@unreleased
tags included in DocBlocks