Update UserFilterObserver, dispatch FeedFollowPipeline jobs

This commit is contained in:
Daniel Supernault 2023-11-12 23:52:10 -07:00
parent e917341651
commit 125208fb9e
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -4,6 +4,8 @@ namespace App\Observers;
use App\UserFilter; use App\UserFilter;
use App\Services\UserFilterService; use App\Services\UserFilterService;
use App\Jobs\HomeFeedPipeline\FeedFollowPipeline;
use App\Jobs\HomeFeedPipeline\FeedUnfollowPipeline;
class UserFilterObserver class UserFilterObserver
{ {
@ -78,10 +80,12 @@ class UserFilterObserver
switch ($userFilter->filter_type) { switch ($userFilter->filter_type) {
case 'mute': case 'mute':
UserFilterService::mute($userFilter->user_id, $userFilter->filterable_id); UserFilterService::mute($userFilter->user_id, $userFilter->filterable_id);
FeedUnfollowPipeline::dispatch($userFilter->user_id, $userFilter->filterable_id)->onQueue('feed');
break; break;
case 'block': case 'block':
UserFilterService::block($userFilter->user_id, $userFilter->filterable_id); UserFilterService::block($userFilter->user_id, $userFilter->filterable_id);
FeedUnfollowPipeline::dispatch($userFilter->user_id, $userFilter->filterable_id)->onQueue('feed');
break; break;
} }
} }
@ -96,10 +100,12 @@ class UserFilterObserver
switch ($userFilter->filter_type) { switch ($userFilter->filter_type) {
case 'mute': case 'mute':
UserFilterService::unmute($userFilter->user_id, $userFilter->filterable_id); UserFilterService::unmute($userFilter->user_id, $userFilter->filterable_id);
FeedFollowPipeline::dispatch($userFilter->user_id, $userFilter->filterable_id)->onQueue('feed');
break; break;
case 'block': case 'block':
UserFilterService::unblock($userFilter->user_id, $userFilter->filterable_id); UserFilterService::unblock($userFilter->user_id, $userFilter->filterable_id);
FeedFollowPipeline::dispatch($userFilter->user_id, $userFilter->filterable_id)->onQueue('feed');
break; break;
} }
} }