1
0
Fork 0

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();
});
}