Update ImportService, filter deleted posts from getImportedPosts endpoint

This commit is contained in:
Daniel Supernault 2023-06-26 04:46:57 -06:00
parent d6d60a8574
commit 10dd348c28
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 5 additions and 1 deletions

View file

@ -59,6 +59,7 @@ class StatusObserver
ProfileStatusService::delete($status->profile_id, $status->id);
if($status->uri == null) {
ImportPost::whereProfileId($status->profile_id)->whereStatusId($status->id)->delete();
ImportService::clearImportedFiles($status->profile_id);
}
}

View file

@ -97,9 +97,12 @@ class ImportService
return Cache::remember($key, 21600, function() use($profileId) {
return ImportPost::whereProfileId($profileId)
->get()
->filter(function($ip) {
return StatusService::get($ip->status_id);
})
->map(function($ip) {
return collect($ip->media)->map(function($m) { return $m['uri']; });
})->flatten();
})->values()->flatten();
});
}