Bulk and single action handlers for Trash tab#392
Open
louiswol94 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores working bulk and single-row actions for the Trash tab on the Manage Snippets screen. After the React rewrite these were either no-ops or wired to the wrong code paths, so this PR re-introduces the legacy behaviour with the new React/REST stack.
Changes
Bulk actions on the Trash tab (
SnippetsListTable.tsx)restore/delete) per item, then refresh the list.snippetsByStatus.get(currentStatus)), instead ofsnippetsByStatus.get('all'). Trashed snippets are only stored in the'trashed'bucket bypartitionSnippetsByStatus, so filtering against'all'silently produced zero targets, which is why Apply appeared to do nothing.Single row actions on the Trash tab (
TableColumns.tsx)Permanent delete via REST (
Snippets_REST_Controller.php)delete_itempreviously decided "trash vs permanent delete" from$item->trashedon the request body. The client never sends that flag on a DELETE, so permanent deletes silently re-trashed already-trashed snippets (a no-op).get_snippet()and uses its realtrashedstate to choose betweentrash_snippet()anddelete_snippet(). As a side benefit, clients can no longer override the server's view of the snippet state.Test plan