-
Notifications
You must be signed in to change notification settings - Fork 108
feat: trash (soft delete) #261
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: core-beta
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR implements a soft delete (trash) feature for code snippets, changing the delete behavior from permanent deletion to moving snippets to a trashed state that can be restored.
- Implements soft delete functionality using an
activestatus of-1to mark snippets as trashed - Adds restore functionality to recover trashed snippets back to inactive state
- Updates UI components to distinguish between "Delete" (soft delete) and "Delete Permanently" actions
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/php/views/partials/list-table-notices.php | Updates notice messages to use "trashed" instead of "deleted" and adds new messages for permanent deletion and restoration |
| src/php/snippet-ops.php | Adds soft_delete_snippet() and restore_snippet() functions for trash functionality |
| src/php/rest-api/class-snippets-rest-controller.php | Updates REST API delete endpoint to use soft delete instead of permanent deletion |
| src/php/class-snippet.php | Adds is_trashed() method and logic to handle trashed state in snippet processing |
| src/php/class-list-table.php | Implements trash view, filtering, and action handling in the snippets list table |
| src/js/components/EditorSidebar/actions/DeleteButton.tsx | Updates delete button dialog text to reflect soft delete behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Great work!
|
|
||
| case 'active': | ||
| return ( is_bool( $value ) ? $value : (bool) $value ) && ! $this->is_condition(); | ||
| return ( is_bool( $value ) ? $value : (bool) $value ) && ! $this->is_condition() && (int) $value != -1; |
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.
Might be worth changing the type of active entirely from string to int given we're using the full breadth of values.
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.
@sheabunge Can we maybe do this in another PR. It started looking like a big scary change 🫣
…-snippets into soft-delete merge
|
No description provided.