diff --git a/web/modules/custom/blog/src/EventSubscriber/PushBlogPostToSocialMedia.php b/web/modules/custom/blog/src/EventSubscriber/PushBlogPostToSocialMedia.php index a6657d4..2ef15a3 100644 --- a/web/modules/custom/blog/src/EventSubscriber/PushBlogPostToSocialMedia.php +++ b/web/modules/custom/blog/src/EventSubscriber/PushBlogPostToSocialMedia.php @@ -48,24 +48,4 @@ final class PushBlogPostToSocialMedia implements EventSubscriberInterface { ]); } - private function shouldBePushed(Post $post): bool { - if ($post->isExternalPost()) { - return FALSE; - } - - if (!$post->isPublished()) { - return FALSE; - } - - if (!$post->shouldSendToSocialMedia()) { - return FALSE; - } - - if ($post->hasBeenSentToSocialMedia()) { - return FALSE; - } - - return TRUE; - } - } diff --git a/web/modules/custom/blog/src/Plugin/QueueWorker/PostPusherQueueWorker.php b/web/modules/custom/blog/src/Plugin/QueueWorker/PostPusherQueueWorker.php index c3f8998..f85503b 100644 --- a/web/modules/custom/blog/src/Plugin/QueueWorker/PostPusherQueueWorker.php +++ b/web/modules/custom/blog/src/Plugin/QueueWorker/PostPusherQueueWorker.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Drupal\opdavies_blog\Plugin\QueueWorker; use Drupal\Core\Queue\QueueWorkerBase; +use Drupal\opdavies_blog\Entity\Node\Post; /** * @QueueWorker( @@ -18,4 +19,24 @@ final class PostPusherQueueWorker extends QueueWorkerBase { public function processItem($data): void { } + private function shouldBePushed(Post $post): bool { + if ($post->isExternalPost()) { + return FALSE; + } + + if (!$post->isPublished()) { + return FALSE; + } + + if (!$post->shouldSendToSocialMedia()) { + return FALSE; + } + + if ($post->hasBeenSentToSocialMedia()) { + return FALSE; + } + + return TRUE; + } + }