Merge pull request #4028 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-12-28 19:44:01 -07:00 committed by GitHub
commit 685d950af4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 19 deletions

View file

@ -55,6 +55,7 @@ use App\Models\Poll;
use App\Models\PollVote; use App\Models\PollVote;
use App\Models\Portfolio; use App\Models\Portfolio;
use App\Models\UserPronoun; use App\Models\UserPronoun;
use App\Jobs\StatusPipeline\StatusDelete;
class DeleteAccountPipeline implements ShouldQueue class DeleteAccountPipeline implements ShouldQueue
{ {
@ -77,6 +78,11 @@ class DeleteAccountPipeline implements ShouldQueue
$user = $this->user; $user = $this->user;
$profile = $user->profile; $profile = $user->profile;
$id = $user->profile_id; $id = $user->profile_id;
Status::whereProfileId($id)->chunk(50, function($statuses) {
foreach($statuses as $status) {
StatusDelete::dispatchNow($status);
}
});
$this->deleteUserColumns($user); $this->deleteUserColumns($user);
AccountService::del($user->profile_id); AccountService::del($user->profile_id);
@ -168,12 +174,6 @@ class DeleteAccountPipeline implements ShouldQueue
DB::table('oauth_auth_codes')->whereUserId($user->id)->delete(); DB::table('oauth_auth_codes')->whereUserId($user->id)->delete();
ProfileSponsor::whereProfileId($id)->delete(); ProfileSponsor::whereProfileId($id)->delete();
Status::whereProfileId($id)->chunk(50, function($statuses) {
foreach($statuses as $status) {
StatusDelete::dispatch($status)->onQueue('high');
}
});
Report::whereUserId($user->id)->forceDelete(); Report::whereUserId($user->id)->forceDelete();
PublicTimelineService::warmCache(true, 400); PublicTimelineService::warmCache(true, 400);
Profile::whereUserId($user->id)->delete(); Profile::whereUserId($user->id)->delete();

View file

@ -137,9 +137,9 @@ class StatusService
public static function del($id, $purge = false) public static function del($id, $purge = false)
{ {
$status = self::get($id);
if($purge) { if($purge) {
$status = self::get($id);
if($status && isset($status['account']) && isset($status['account']['id'])) { if($status && isset($status['account']) && isset($status['account']['id'])) {
Cache::forget('profile:embed:' . $status['account']['id']); Cache::forget('profile:embed:' . $status['account']['id']);
} }

View file

@ -28,13 +28,17 @@ class WebfingerService
return []; return [];
} }
$res = Http::retry(3, 100) try {
->acceptJson() $res = Http::retry(3, 100)
->withHeaders([ ->acceptJson()
'User-Agent' => '(Pixelfed/' . config('pixelfed.version') . '; +' . config('app.url') . ')' ->withHeaders([
]) 'User-Agent' => '(Pixelfed/' . config('pixelfed.version') . '; +' . config('app.url') . ')'
->timeout(20) ])
->get($url); ->timeout(20)
->get($url);
} catch (\Illuminate\Http\Client\ConnectionException $e) {
return [];
}
if(!$res->successful()) { if(!$res->successful()) {
return []; return [];
@ -48,11 +52,9 @@ class WebfingerService
$link = collect($webfinger['links']) $link = collect($webfinger['links'])
->filter(function($link) { ->filter(function($link) {
return $link && return $link &&
isset($link['rel']) && isset($link['rel'], $link['type'], $link['href']) &&
isset($link['type']) && $link['rel'] === 'self' &&
isset($link['href']) && in_array($link['type'], ['application/activity+json','application/ld+json; profile="https://www.w3.org/ns/activitystreams"']);
$link['rel'] == 'self' &&
$link['type'] == 'application/activity+json' || $link['type'] == 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
}) })
->pluck('href') ->pluck('href')
->first(); ->first();