Merge pull request #2506 from pixelfed/staging

Update avatars, use jpeg default
This commit is contained in:
daniel 2020-12-15 00:38:23 -07:00 committed by GitHub
commit a52a89ca8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 34 additions and 12 deletions

View file

@ -141,6 +141,7 @@
- Updated PostComponent, add reply modal. ([a10d851f](https://github.com/pixelfed/pixelfed/commit/a10d851f))
- Updated Timeline, remove simple mode and set labs deprecation date. ([df9c3adf](https://github.com/pixelfed/pixelfed/commit/df9c3adf))
- Updated 2FA setup, fix qrcode handler. ([cd2661fc](https://github.com/pixelfed/pixelfed/commit/cd2661fc))
- Updated avatars, use jpeg default. ([f6528c84](https://github.com/pixelfed/pixelfed/commit/f6528c84))
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
### Added

View file

@ -53,7 +53,11 @@ class AvatarDefaultMigration extends Command
Avatar::whereChangeCount(0)->chunk(50, function($avatars) use ($bar) {
foreach($avatars as $avatar) {
if($avatar->media_path == 'public/avatars/default.png' || $avatar->thumb_path == 'public/avatars/default.png') {
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'
) {
continue;
}
@ -72,8 +76,8 @@ class AvatarDefaultMigration extends Command
@unlink(storage_path('app/' . $avatar->thumb_path));
}
$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->change_count = $avatar->change_count + 1;
$avatar->save();

View file

@ -120,7 +120,12 @@ class AvatarController extends Controller
$avatar = $profile->avatar;
if($avatar->media_path == 'public/avatars/default.png' || $avatar->thumb_path == 'public/avatars/default.png') {
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' ||
) {
return;
}
@ -132,8 +137,8 @@ class AvatarController extends Controller
@unlink(storage_path('app/' . $avatar->thumb_path));
}
$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->change_count = $avatar->change_count + 1;
$avatar->save();

View file

@ -70,7 +70,10 @@ class AvatarOptimize implements ShouldQueue
protected function deleteOldAvatar($new, $current)
{
if (storage_path('app/'.$new) == $current || Str::endsWith($current, 'avatars/default.png')) {
if ( storage_path('app/'.$new) == $current ||
Str::endsWith($current, 'avatars/default.png') ||
Str::endsWith($current, 'avatars/default.jpg'))
{
return;
}
if (is_file($current)) {

View file

@ -41,7 +41,7 @@ class CreateAvatar implements ShouldQueue
public function handle()
{
$profile = $this->profile;
$path = 'public/avatars/default.png';
$path = 'public/avatars/default.jpg';
$avatar = new Avatar();
$avatar->profile_id = $profile->id;
$avatar->media_path = $path;

View file

@ -48,11 +48,17 @@ 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') {
if( is_file($path) &&
$avatar->media_path != 'public/avatars/default.png' &&
$avatar->media_path != 'public/avatars/default.jpg'
) {
@unlink($path);
}
$path = storage_path('app/'.$avatar->thumb_path);
if(is_file($path) && $avatar->thumb_path != 'public/avatars/default.png') {
if( is_file($path) &&
$avatar->thumb_path != 'public/avatars/default.png' &&
$avatar->media_path != 'public/avatars/default.jpg'
) {
@unlink($path);
}
}

View file

@ -156,7 +156,7 @@ class Profile extends Model
public function avatar()
{
return $this->hasOne(Avatar::class)->withDefault([
'media_path' => 'public/avatars/default.png',
'media_path' => 'public/avatars/default.jpg',
'change_count' => 0
]);
}

View file

@ -103,6 +103,8 @@ class RestrictedNames
'api',
'audio',
'auth',
'avatar',
'avatars',
'b',
'bartender',
'broadcast',

View file

@ -1,3 +1,4 @@
*
!.gitignore
!default.png
!default.png
!default.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 14 KiB