From 9eecaea31a0f9a5f79bdf7792838e956174a3e71 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 1 Feb 2017 22:16:32 +0000 Subject: [PATCH] Attempt to fix bookchildren and user getThumb Hopefully Fixes #292 and #294 and #287 --- app/Repos/EntityRepo.php | 4 ++-- app/User.php | 2 +- composer.json | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Repos/EntityRepo.php b/app/Repos/EntityRepo.php index f1428735c..8a8740d76 100644 --- a/app/Repos/EntityRepo.php +++ b/app/Repos/EntityRepo.php @@ -332,12 +332,12 @@ class EntityRepo $parents[$key] = $entities[$index]; $parents[$key]->setAttribute('pages', collect()); } - if ($entities[$index]->chapter_id === 0) $tree[] = $entities[$index]; + if ($entities[$index]->chapter_id === 0 || $entities[$index]->chapter_id === '0') $tree[] = $entities[$index]; $entities[$index]->book = $book; } foreach ($entities as $entity) { - if ($entity->chapter_id === 0) continue; + if ($entity->chapter_id === 0 || $entity->chapter_id === '0') continue; $parentKey = 'BookStack\\Chapter:' . $entity->chapter_id; $chapter = $parents[$parentKey]; $chapter->pages->push($entity); diff --git a/app/User.php b/app/User.php index afcd9af70..8033557e4 100644 --- a/app/User.php +++ b/app/User.php @@ -165,7 +165,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon if ($imageId === 0 || $imageId === '0' || $imageId === null) return $default; try { - $avatar = baseUrl($this->avatar->getThumb($size, $size, false)); + $avatar = $this->avatar ? baseUrl($this->avatar->getThumb($size, $size, false)) : $default; } catch (\Exception $err) { $avatar = $default; } diff --git a/composer.json b/composer.json index 5a8fd67ae..8d963022c 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,9 @@ ], "post-install-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postInstall", - "php artisan optimize" + "php artisan optimize", + "php artisan cache:clear", + "php artisan view:clear" ], "post-update-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postUpdate",