-
Notifications
You must be signed in to change notification settings - Fork 4.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
Consolidate and fix rename
post action
#61857
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -96 B (-0.01%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
d7c8253
to
bf63d44
Compare
I like this approach. |
Flaky tests detected in 9c4b3cb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9191364525
|
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.
Thanks, Nik!
The fix tests well for me ✅
Also, while testing this fix, I noticed that theme patterns (PATTERN_TYPES.theme
) have "Edit" and "Move to Trash" actions available in DataViews. These actions do nothing and should probably only be available for user patterns.
|
isTemplateOrTemplatePart ? resetTemplateAction : restorePostAction, | ||
isTemplateOrTemplatePart | ||
? deleteTemplateAction | ||
: permanentlyDeletePostAction, |
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.
Sidenote: The way we build the actions
array here is difficult to parse. Maybe we should convert it into separate if conditions.
Example:
if ( condition ) {
actions.push( action );
}
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 order matters for UI for now and would need multiple if
conditions. So I didn't do it here, even though I thought about it too. Will check it in follow ups where more actions will be consolidated.
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.
It's definitely not a blocker, just something that comes to my mind every time I see it 😄
I agree. We should have a flag in REST response.
Yeah, I'll handle them in follow ups. |
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
What?
Part of: #61787
After a recent refactor to post actions some regressions were introduced, where we show more actions than we should in certain cases. An example is the
rename
post action which has different conditions based on some core post types (like templates, template parts, etc..). Additionally the goal is to use a single action for all post types where we can, likerename, delete, etc..
.This PR consolidates the
rename
action and adds all needed checks for core post types. In the future when we'll have an API for third party devs to register actions, it should be possible to also remove core actions too. This way they would be able to implement a custom rename action if they want..I've changed only one action here to discuss the approach and if deemed fine, I'll update more either here or in follow ups.
Testing Instructions
rename
action works as expected and is shown only when it should. For example it shouldn't be shown in theme patterns or templates or template parts.