Fix resolution comment actions becoming enabled after reopening#73243
Fix resolution comment actions becoming enabled after reopening#73243karthick-murugan wants to merge 4 commits intoWordPress:trunkfrom
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. |
Updated both the issues @t-hamano REC-20251114144544.mp4 |
Sorry, on reflection, this may not be ideal. For consistency, we should probably allow editing even when there is no comment. Later, some users may want to add a comment to the reopen action. Additionally, the current implementation makes it a bit difficult for me to predict what actions will be available - the actions can only be determined by the What do you think about the following implementation? cc @Mamaduka const isParentComment = thread.parent === 0;
const hasResolved =
thread.status === 'approved' || parent?.status === 'approved';
const isReopenComment = thread.meta?._wp_note_status === 'reopen';
const isResolvedComment = thread.meta?._wp_note_status === 'resolved';
const isResolutionComment = isReopenComment || isResolvedComment;
const actions = [
{
id: 'edit',
title: __( 'Edit' ),
isEligible: () => ! isResolvedComment && ! hasResolved,
onClick: () => {
setActionState( 'edit' );
},
},
{
id: 'reopen',
title: _x( 'Reopen', 'Reopen note' ),
isEligible: () => isParentComment && hasResolved,
onClick: () => {
onEdit( { id: thread.id, status: 'hold' } );
},
},
{
id: 'delete',
title: __( 'Delete' ),
isEligible: () =>
isParentComment || ( ! isResolutionComment && ! hasResolved ),
onClick: () => {
setActionState( 'delete' );
setShowConfirmDialog( true );
},
},
];
const moreActions = actions.filter( ( item ) => item.isEligible() ); |
|
Thanks for the suggestion, @t-hamano! I've updated the implementation to follow your suggested approach and it works good. Can you take a look. |
t-hamano
left a comment
There was a problem hiding this comment.
LGTM! To my understanding, this is the correct behavior.
@Mamaduka @adamsilverstein, I'd be happy to receive second feedback to see if my understanding is correct.
| Note Status | Note Type | Available Actions |
|---|---|---|
| Opened | Parent note | Edit, Delete |
| Opened | Reply | Edit, Delete |
| Opened | Reply (Marked as resolved) | None |
| Opened | Reply (Reopened) | Edit |
| Resolved | Parent note | Reopen, Delete |
| Resolved | Reply | None |
| Resolved | Reply (Marked as resolved) | None |
| Resolved | Reply (Reopened) | None |
| id: 'edit', | ||
| title: __( 'Edit' ), | ||
| isEligible: ( { status } ) => status !== 'approved', | ||
| isEligible: () => ! isResolvedComment && ! hasResolved, |
There was a problem hiding this comment.
The whole point of the isEligible callback is to derive value at run time. I know there will be some duplication, but that's okay.
Deriving everything outside kind of defeats the whole purpose of this method.


What?
Closes #73236
Fixes an issue where menu actions (Edit, Delete) were incorrectly enabled for system-generated resolution comments after using "Reopen & Reply".
Why?
When a note is resolved, a system-generated "Marked as resolved" comment is created. These resolution messages should always remain non-interactive and immutable. However, after using "Reopen & Reply", the menu actions became incorrectly enabled for the previously resolved entry, allowing users to interact with system-generated resolution messages in ways that should not be permitted.
How?
Disable menu actions for resolution comments: Ensures that resolution comments always have an empty
moreActionsarray, preventing any menu interactions.Testing Instructions
Test system-generated resolution messages remain immutable:
Test user replies via "Reopen & Reply" remain editable:
Test system-generated "Reopened" messages:
Video
REC-20251113201442.mp4