]> BookStack Code Mirror - bookstack/commitdiff
Attempt to fix bookchildren and user getThumb
authorDan Brown <redacted>
Wed, 1 Feb 2017 22:16:32 +0000 (22:16 +0000)
committerDan Brown <redacted>
Wed, 1 Feb 2017 22:16:32 +0000 (22:16 +0000)
Hopefully Fixes #292 and #294 and #287

app/Repos/EntityRepo.php
app/User.php
composer.json

index f1428735cc340149a3c33d0d3ed76e298cfe7f63..8a8740d76cf6cf18faf5a9163e2f75bb0b4d5a79 100644 (file)
@@ -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);
index afcd9af70c4f8094cea9fa52c9bfc0eaefa43068..8033557e4cb9a0a048c1d7112c90f84dc4e4bf70 100644 (file)
@@ -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;
         }
index 5a8fd67aea14d39ff03eee5bad2c599ea41837dc..8d963022cb34be5e9bba26e1cf5c5872ccd08240 100644 (file)
@@ -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",