mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update avatar deletion
This commit is contained in:
parent
14fa51fa30
commit
a641db0764
2 changed files with 7 additions and 12 deletions
|
@ -74,17 +74,6 @@ class DeleteAccountPipeline implements ShouldQueue
|
|||
if($user->profile) {
|
||||
$avatar = $user->profile->avatar;
|
||||
|
||||
if(is_file($avatar->media_path)) {
|
||||
if($avatar->media_path != 'public/avatars/default.png') {
|
||||
unlink($avatar->media_path);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_file($avatar->thumb_path)) {
|
||||
if($avatar->thumb_path != 'public/avatars/default.png') {
|
||||
unlink($avatar->thumb_path);
|
||||
}
|
||||
}
|
||||
$avatar->forceDelete();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,14 @@ class AvatarObserver
|
|||
public function deleting(Avatar $avatar)
|
||||
{
|
||||
$path = storage_path('app/'.$avatar->media_path);
|
||||
if(is_file($path) && $avatar->media_path != 'public/avatars/default.png') {
|
||||
@unlink($path);
|
||||
}
|
||||
$path = storage_path('app/'.$avatar->thumb_path);
|
||||
if(is_file($path) && $avatar->thumb_path != 'public/avatars/default.png') {
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the avatar "restored" event.
|
||||
|
|
Loading…
Reference in a new issue