Skip to content

Commit

Permalink
fix: correct PostWasApproved event trigger condition
Browse files Browse the repository at this point in the history
Ensure the PostWasApproved event is only raised for posts that are not hidden. This fixes the issue where the event was incorrectly triggered for hidden posts. Additionally, the post's approval status is set to true upon deletion to remove any pending approval status.
  • Loading branch information
rafaucau committed Nov 6, 2023
1 parent f07336e commit 6596569
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extensions/approval/src/Listener/ApproveContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function approvePost(Saving $event)
if (! empty($isApproved)) {
$post->is_approved = true;

$post->raise(new PostWasApproved($post, $event->actor));
if(! $post->hidden_at) {
$post->raise(new PostWasApproved($post, $event->actor));
}
}
}
}

0 comments on commit 6596569

Please sign in to comment.