mirror of https://github.com/pixelfed/pixelfed.git
Update FollowPipeline
This commit is contained in:
parent
bd96840587
commit
7b4256549a
|
@ -3,7 +3,13 @@
|
|||
namespace App\Jobs\FollowPipeline;
|
||||
|
||||
use App\Follower;
|
||||
use App\Jobs\PushNotificationPipeline\FollowPushNotifyPipeline;
|
||||
use App\Notification;
|
||||
use App\Services\AccountService;
|
||||
use App\Services\FollowerService;
|
||||
use App\Services\NotificationAppGatewayService;
|
||||
use App\Services\PushNotificationService;
|
||||
use App\User;
|
||||
use Cache;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
@ -11,9 +17,6 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
|||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use App\Services\AccountService;
|
||||
use App\Services\FollowerService;
|
||||
|
||||
class FollowPipeline implements ShouldQueue
|
||||
{
|
||||
|
@ -74,7 +77,7 @@ class FollowPipeline implements ShouldQueue
|
|||
|
||||
if ($target->user_id && $target->domain === null) {
|
||||
try {
|
||||
$notification = new Notification();
|
||||
$notification = new Notification;
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'follow';
|
||||
|
@ -84,6 +87,15 @@ class FollowPipeline implements ShouldQueue
|
|||
} catch (Exception $e) {
|
||||
Log::error($e);
|
||||
}
|
||||
|
||||
if (NotificationAppGatewayService::enabled()) {
|
||||
if (PushNotificationService::check('follow', $target->id)) {
|
||||
$user = User::whereProfileId($target->id)->first();
|
||||
if ($user && $user->expo_token && $user->notify_enabled) {
|
||||
FollowPushNotifyPipeline::dispatchSync($user->expo_token, $actor->username);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue