kopia lustrzana https://github.com/pixelfed/pixelfed
				
				
				
			Update AvatarController, remove deprecated thumb_path
							rodzic
							
								
									1e9958f521
								
							
						
					
					
						commit
						889c3d8758
					
				|  | @ -183,7 +183,6 @@ class BaseApiController extends Controller | |||
|             $avatar = Avatar::whereProfileId($profile->id)->firstOrFail(); | ||||
|             $opath = $avatar->media_path; | ||||
|             $avatar->media_path = "$public/$name"; | ||||
|             $avatar->thumb_path = null; | ||||
|             $avatar->change_count = ++$avatar->change_count; | ||||
|             $avatar->last_processed_at = null; | ||||
|             $avatar->save(); | ||||
|  |  | |||
|  | @ -35,7 +35,6 @@ class AvatarController extends Controller | |||
|             $avatar = Avatar::firstOrNew(['profile_id' => $profile->id]); | ||||
|             $currentAvatar = $avatar->recentlyCreated ? null : storage_path('app/'.$profile->avatar->media_path); | ||||
|             $avatar->media_path = "$public/$name"; | ||||
|             $avatar->thumb_path = null; | ||||
|             $avatar->change_count = ++$avatar->change_count; | ||||
|             $avatar->last_processed_at = null; | ||||
|             $avatar->save(); | ||||
|  | @ -121,10 +120,7 @@ class AvatarController extends Controller | |||
|         $avatar = $profile->avatar; | ||||
| 
 | ||||
|         if( $avatar->media_path == 'public/avatars/default.png' ||  | ||||
|             $avatar->thumb_path == 'public/avatars/default.png' || | ||||
|             $avatar->media_path == 'public/avatars/default.jpg' ||  | ||||
|             $avatar->thumb_path == 'public/avatars/default.jpg' | ||||
| 
 | ||||
|             $avatar->media_path == 'public/avatars/default.jpg' | ||||
|         ) { | ||||
|             return; | ||||
|         } | ||||
|  | @ -133,12 +129,7 @@ class AvatarController extends Controller | |||
|             @unlink(storage_path('app/' . $avatar->media_path)); | ||||
|         } | ||||
| 
 | ||||
|         if(is_file(storage_path('app/' . $avatar->thumb_path))) { | ||||
|             @unlink(storage_path('app/' . $avatar->thumb_path)); | ||||
|         } | ||||
| 
 | ||||
|         $avatar->media_path = 'public/avatars/default.jpg'; | ||||
|         $avatar->thumb_path = 'public/avatars/default.jpg'; | ||||
|         $avatar->change_count = $avatar->change_count + 1; | ||||
|         $avatar->save(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -58,7 +58,6 @@ class AvatarOptimize implements ShouldQueue | |||
|             $img->save($file, $quality); | ||||
| 
 | ||||
|             $avatar = Avatar::whereProfileId($this->profile->id)->firstOrFail(); | ||||
|             $avatar->thumb_path = $avatar->media_path; | ||||
|             $avatar->change_count = ++$avatar->change_count; | ||||
|             $avatar->last_processed_at = Carbon::now(); | ||||
|             $avatar->save(); | ||||
|  |  | |||
|  | @ -45,7 +45,6 @@ class CreateAvatar implements ShouldQueue | |||
|         $avatar = new Avatar(); | ||||
|         $avatar->profile_id = $profile->id; | ||||
|         $avatar->media_path = $path; | ||||
|         $avatar->thumb_path = $path; | ||||
|         $avatar->change_count = 0; | ||||
|         $avatar->last_processed_at = \Carbon\Carbon::now(); | ||||
|         $avatar->save(); | ||||
|  |  | |||
|  | @ -54,13 +54,6 @@ class AvatarObserver | |||
|         ) { | ||||
|             @unlink($path); | ||||
|         } | ||||
|         $path = storage_path('app/'.$avatar->thumb_path); | ||||
|         if( is_file($path) &&  | ||||
|             $avatar->thumb_path != 'public/avatars/default.png' && | ||||
|             $avatar->media_path != 'public/avatars/default.jpg' | ||||
|         ) { | ||||
|             @unlink($path); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Daniel Supernault
						Daniel Supernault