-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Editor: Use post.utils for Status Testing #1712
Conversation
@timmyc I think this might need some updating following some work that went on with the Notices. They received some love recently. Set post as private Update private post Notice doesn't mention private blog - just that it was updated. It does also show a JavaScript error in the prop to the notice.Publish a public post Update a public post This was the same as for the private post, so I am not copying the screenshots here. The error message came back. I think that if the notice code gets updated this will run smoothly. |
7e7237e
to
7cb3cc1
Compare
@dmsnell thanks for the review - I had forgotten about this PR over the holidays :)
Indeed this is an odd flow, but it is how WordPress works. When a post status is set to As for warning messages, in 7cb3cc1 I added |
why are they being passed as an array and is it the right solution to just accept the arrays? |
the output of The |
would you be willing to humor me and paste the output of one of those translate calls here? I'm simply not grasping what the array elements would be |
Surely. So the array here was a result of publishing a post, First and last elements are strings, in position |
thanks @timmyc that helps a bunch. I didn't realize it handled such translation strings like that. my previous thoughts were that it passed a React element. there is one way I would recommend supporting our code here, though I admit the likelihood of messing up here is probably pretty slim. we should basically have either a single or an array of text: PropTypes.oneOfType( [
PropTypes.oneOfType( [ PropTypes.string, PropTypes.node ] ),
PropTypes.arrayOf( PropTypes.oneOfType( [ PropTypes.string, PropTypes.node ] ) )
] ).isRequired so this should cover all our cases. I would be interested at least to learn if it passes all the tests and works in the code. the thing I like here is that it gives slightly more hinting to the developers what should be expected, whereas |
Thanks @timmyc - next ❓ are those |
Backed out in e3c9268 - but did discover some places it is needed. I'll tackle that in a different branch though since this one has meandered a bit. |
LGTM 👍 |
Editor: Use post.utils for Status Testing
While working in
post-editor.jsx
today I noticed a few places where we are still manually testingpost.status
instead of leveraginglib/posts/utils
. This branch is simply some trash pickup for the locations where the post status was being manually tested. Additionally it adds a new method for testing to see if a post's status isprivate
and some tests forisPublished()
.To Test