Skip to content

Commit

Permalink
Update comment status before dispatching approveNote action
Browse files Browse the repository at this point in the history
  • Loading branch information
phcp committed Oct 21, 2024
1 parent 6acc7f7 commit a533244
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ const setApproveStatus =
( noteId, siteId, commentId, isApproved, type, restClient ) => ( dispatch ) => {
const comment = wpcom().site( siteId ).comment( commentId );

comment.update( { status: isApproved ? 'approved' : 'unapproved' }, () =>
// getNote() updates the redux store with a fresh object from the API
restClient.getNote( noteId )
);

dispatch( approveNote( noteId, isApproved ) );
bumpStat( isApproved ? 'unapprove-comment' : 'approve-comment' );
recordTracksEvent( 'calypso_notification_note_' + ( isApproved ? 'approve' : 'unapprove' ), {
note_type: type,
} );

comment.update( { status: isApproved ? 'approved' : 'unapproved' }, () =>
// getNote() updates the redux store with a fresh object from the API
restClient.getNote( noteId )
);
};

export default setApproveStatus;

0 comments on commit a533244

Please sign in to comment.