Skip to content

Commit 9eecaea

Browse files
committed
Attempt to fix bookchildren and user getThumb
Hopefully Fixes #292 and #294 and #287
1 parent 492e2f1 commit 9eecaea

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

app/Repos/EntityRepo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,12 @@ public function getBookChildren(Book $book, $filterDrafts = false)
332332
$parents[$key] = $entities[$index];
333333
$parents[$key]->setAttribute('pages', collect());
334334
}
335-
if ($entities[$index]->chapter_id === 0) $tree[] = $entities[$index];
335+
if ($entities[$index]->chapter_id === 0 || $entities[$index]->chapter_id === '0') $tree[] = $entities[$index];
336336
$entities[$index]->book = $book;
337337
}
338338

339339
foreach ($entities as $entity) {
340-
if ($entity->chapter_id === 0) continue;
340+
if ($entity->chapter_id === 0 || $entity->chapter_id === '0') continue;
341341
$parentKey = 'BookStack\\Chapter:' . $entity->chapter_id;
342342
$chapter = $parents[$parentKey];
343343
$chapter->pages->push($entity);

app/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function getAvatar($size = 50)
165165
if ($imageId === 0 || $imageId === '0' || $imageId === null) return $default;
166166

167167
try {
168-
$avatar = baseUrl($this->avatar->getThumb($size, $size, false));
168+
$avatar = $this->avatar ? baseUrl($this->avatar->getThumb($size, $size, false)) : $default;
169169
} catch (\Exception $err) {
170170
$avatar = $default;
171171
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
],
4848
"post-install-cmd": [
4949
"Illuminate\\Foundation\\ComposerScripts::postInstall",
50-
"php artisan optimize"
50+
"php artisan optimize",
51+
"php artisan cache:clear",
52+
"php artisan view:clear"
5153
],
5254
"post-update-cmd": [
5355
"Illuminate\\Foundation\\ComposerScripts::postUpdate",

0 commit comments

Comments
 (0)