mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 08:20:46 +00:00
Update DeleteAccountPipeline
This commit is contained in:
parent
284a694030
commit
578d2f353d
1 changed files with 18 additions and 2 deletions
|
@ -30,6 +30,8 @@ use App\{
|
||||||
ReportLog,
|
ReportLog,
|
||||||
StatusHashtag,
|
StatusHashtag,
|
||||||
Status,
|
Status,
|
||||||
|
Story,
|
||||||
|
StoryView,
|
||||||
User,
|
User,
|
||||||
UserDevice,
|
UserDevice,
|
||||||
UserFilter,
|
UserFilter,
|
||||||
|
@ -91,11 +93,25 @@ class DeleteAccountPipeline implements ShouldQueue
|
||||||
Like::whereProfileId($id)->forceDelete();
|
Like::whereProfileId($id)->forceDelete();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DB::transaction(function() use ($user) {
|
||||||
|
$pid = $this->user->profile_id;
|
||||||
|
|
||||||
|
StoryView::whereProfileId($pid)->delete();
|
||||||
|
$stories = Story::whereProfileId($pid)->get();
|
||||||
|
foreach($stories as $story) {
|
||||||
|
$path = storage_path('app/'.$story->path);
|
||||||
|
if(is_file($path)) {
|
||||||
|
unlink($path);
|
||||||
|
}
|
||||||
|
$story->forceDelete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
DB::transaction(function() use ($user) {
|
DB::transaction(function() use ($user) {
|
||||||
$medias = Media::whereUserId($user->id)->get();
|
$medias = Media::whereUserId($user->id)->get();
|
||||||
foreach($medias as $media) {
|
foreach($medias as $media) {
|
||||||
$path = $media->media_path;
|
$path = storage_path('app/'.$media->media_path);
|
||||||
$thumb = $media->thumbnail_path;
|
$thumb = storage_path('app/'.$media->thumbnail_path);
|
||||||
if(is_file($path)) {
|
if(is_file($path)) {
|
||||||
unlink($path);
|
unlink($path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue