Return early if should not be sent to social media

Return early and don't send the post to social media if the `Post to
social media` checkbox is not checked.

References #249
This commit is contained in:
Oliver Davies 2020-10-07 22:58:17 +01:00
parent 2d06f5e8d4
commit eb23d93fe0

View file

@ -53,6 +53,10 @@ final class PushBlogPostToSocialMedia implements EventSubscriberInterface {
return;
}
if (!$entity->shouldSendToSocialMedia()) {
return;
}
// If this post has already been sent to social media, do not send it again.
if ($entity->hasBeenSentToSocialMedia()) {
return;