More cleanup

pull/6194/head
Emily Love Watson 1 month ago
parent 453ae4b32e
commit a07f3595d8
No known key found for this signature in database
GPG Key ID: 69981387DE7BC2EE

@ -3,6 +3,8 @@
namespace App\Jobs\MovePipeline; namespace App\Jobs\MovePipeline;
use App\Follower; use App\Follower;
use App\Http\Controllers\FollowerController;
use App\Profile;
use App\Util\ActivityPub\Helpers; use App\Util\ActivityPub\Helpers;
use DateTime; use DateTime;
use DB; use DB;
@ -118,8 +120,10 @@ class MoveMigrateFollowersPipeline implements ShouldQueue
if (! $follower->private_key || ! $follower->username || ! $follower->user_id || $follower->status === 'delete') { if (! $follower->private_key || ! $follower->username || ! $follower->user_id || $follower->status === 'delete') {
continue; continue;
} }
if ($targetInbox) { if ($targetInbox) {
MoveSendFollowPipeline::dispatch($follower, $targetInbox, $targetPid, $target)->onQueue('follow'); $followerProfile = Profile::find($follower->id);
(new FollowerController)->sendFollow($followerProfile, $targetAccount);
} else { } else {
Follower::updateOrCreate([ Follower::updateOrCreate([
'profile_id' => $follower->id, 'profile_id' => $follower->id,

@ -81,21 +81,16 @@ class ProfileMigrationMoveFollowersPipeline implements ShouldBeUniqueUntilProces
} }
$targetInbox = $ne['sharedInbox'] ?? $ne['inbox_url']; $targetInbox = $ne['sharedInbox'] ?? $ne['inbox_url'];
foreach (Follower::whereFollowingId($this->oldPid)->where('local_profile', true)->lazyById(200, 'id') as $follower) { foreach (Follower::whereFollowingId($this->oldPid)->lazyById(200, 'id') as $follower) {
try { try {
if ($targetInbox) { if ($targetInbox && $follower->local_profile) {
$followerProfile = Profile::find($follower->profile_id); $followerProfile = Profile::find($follower->profile_id);
Follower::updateOrCreate([
'profile_id' => $follower->profile_id,
'following_id' => $this->newPid,
]);
(new FollowerController)->sendFollow($followerProfile, $ne); (new FollowerController)->sendFollow($followerProfile, $ne);
} else {
Follower::updateOrCreate([
'profile_id' => $follower->profile_id,
'following_id' => $this->newPid,
]);
} }
Follower::updateOrCreate([
'profile_id' => $follower->profile_id,
'following_id' => $this->newPid,
]);
} catch (Exception $e) { } catch (Exception $e) {
Log::error($e); Log::error($e);
} }

Loading…
Cancel
Save