-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Offline Mode: Trash, Delete, Restore #22947
Offline Mode: Trash, Delete, Restore #22947
Conversation
/// - Parameters: | ||
/// - postID: Object ID of the given post | ||
/// - status: The post's original status before it's moved to the trash bin. | ||
func restore<P: AbstractPost>(_ postID: TaggedManagedObjectID<P>, to status: BasePost.Status) async throws { |
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.
There is no need for a separate restore
. It's "Move to draft" and in terms of the implementation it's "patch" with { "status": "draft" }
.
@@ -642,6 +642,47 @@ class AbstractPostListViewController: UIViewController, | |||
navigationController?.present(navWrapper, animated: true) | |||
} | |||
|
|||
func _trash(_ post: AbstractPost, completion: @escaping () -> Void) { |
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.
The implementation is now shared between posts and pages.
I thought it would also be clearer if there was a separate .delete
action, so I added it.
e96a79d
to
e571240
Compare
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
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.
Works as expected, except for this flow:
Verify that if you trash a post that was permanently deleted, it deletes it form the list
I get an error "User cannot delete this post"
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-04-04.at.16.23.38.mp4
I reported in it our channel and asked Enej to help look into it. I also compared it with wp.com and it uses the I also totally forgot the following scenario that is now fixed:
|
Sounds good.
Tested - works as described! |
Adds support for trash, delete, and restore (existing move to draft).
When you trash a post, it deletes your local unsynced changes after a confirmation, sends a patch, and moves it to trash. Invariant: all posts in the "Trash" tab have no unsynced changes.
When you delete a post, it uses a new endpoint.
To test:
{ "status": "trash" }
in the requestRegression Notes
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: