-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Chrome: Adding the trash post link to the sidebar #862
Conversation
Yeah, I know. We can probably redirect to the posts list, but I'm not sure we can trigger a notice with JS (maybe we have an endpoint I'm not aware of for that?) |
This is weird, it's working for me. Maybe the "delete" post endpoint requires an extra capability we should check? |
It'd be nice if we could get this working somehow, or if not we should chat with the #core-restapi folks and add the endpoint to our wishlist. |
I found that we can achieve the required behaviour by redirecting to an url like this |
306f8d1
to
0a13bea
Compare
@jasmussen Could you share more details on the 405? Are you using an admin user? any particular thing about your install? I'm not sure how to reproduce this. WP version? I would like to get that fixed before merging here and leave the redirection for #867 |
Yes, I'm using the latest version of VVV, and latest WordPress stable. Chrome browser, admin user. When I click the button nothing happens, but I get a JS error. Here are some screenshots: The REST API URL it appears to be loading, is this: http://local.wordpress.dev/?rest_route=/wp/v2/posts/56 which returns the following information:
Screenshot: Though do note that when I load the same URL inside the dev tools, I instead get an NGINX error. |
Really weird, the only thing I can think of when I look at the code that could trigger that is not having the delete post capability. But I think the admin user has it. Any idea @nylen |
@youknowriad I think redirecting to the posts listing should go in the initial version, I added this just as a relative link in 36badc0 and we can come up with a better way later on. @jasmussen I'm not sure what is causing this error for you, especially if you're doing this as an admin user. However, note that visiting that URL directly in your browser is not the same thing:
Can you capture the actual response from the |
Ah, nevermind, we already have the error info :) It's the @jasmussen are you able to save posts correctly? (this uses a request method of |
I have made no changes to the stock vvv install, except the occasional I want to say this is an issue with my setup, so please don't let this be a blocker for this PR to be merged. Whatever it is, if anything, I'm sure we can fix it in a separate PR. When I get bandwidth, I'll try wp docker instead of vvv, and I'll also try a fresh build of the plugin on my own site. We'll track this down. |
I agree, this is definitely a server config issue, though I am not sure how that is happening given that you are running stock vvv. We should track this down separately. You could also try playing with the options under As a potential workaround on our side if this turns out to be a common issue, we can limit the API requests to |
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 think this PR is good to go.
I think I figured out at least why I'm getting the "file not found" error. The file doesn't exist: That's the I don't know if this specific error was the cause of my post trashing woes, but mentioning nonetheless. |
@nylen Thanks James for the redirection. This is good for now. We'll figure out a way to avoid the relative links later. @jasmussen Have you tried clearing the vendor folder and rebuilding? I don't have this file either but it's not an issue since it's not being loaded in this branch (I think this file is being added in another PR). |
Can you clarify what clearing the vendor folder and rebuilding means? Also, would this potentially fix my trash button woes, or perhaps just the list block error? |
@jasmussen I don't know if this would fix anything. but something like |
@jasmussen the |
Well I'll be. Not seeing it in master. So closing #885. |
This PR adds a trash post link to the sidebar.
Open questions