1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Simplified activity facade interface

Also cleaned up any other bits along the way.
This commit is contained in:
Dan Brown
2019-09-19 18:03:17 +01:00
parent 2a2cc858f0
commit 615b2de433
11 changed files with 68 additions and 46 deletions

View File

@ -58,11 +58,6 @@ class BookController extends Controller
$view = setting()->getUser($this->currentUser, 'books_view_type', config('app.views.books'));
$sort = setting()->getUser($this->currentUser, 'books_sort', 'name');
$order = setting()->getUser($this->currentUser, 'books_sort_order', 'asc');
$sortOptions = [
'name' => trans('common.sort_name'),
'created_at' => trans('common.sort_created_at'),
'updated_at' => trans('common.sort_updated_at'),
];
$books = $this->bookRepo->getAllPaginated('book', 18, $sort, $order);
$recents = $this->signedIn ? $this->bookRepo->getRecentlyViewed('book', 4, 0) : false;
@ -80,7 +75,6 @@ class BookController extends Controller
'view' => $view,
'sort' => $sort,
'order' => $order,
'sortOptions' => $sortOptions,
]);
}
@ -114,6 +108,7 @@ class BookController extends Controller
* @throws NotFoundException
* @throws ImageUploadException
* @throws ValidationException
* @throws Throwable
*/
public function store(Request $request, string $shelfSlug = null)
{
@ -192,6 +187,7 @@ class BookController extends Controller
* @throws ImageUploadException
* @throws NotFoundException
* @throws ValidationException
* @throws Throwable
*/
public function update(Request $request, string $slug)
{
@ -340,7 +336,7 @@ class BookController extends Controller
{
$book = $this->bookRepo->getBySlug($bookSlug);
$this->checkOwnablePermission('book-delete', $book);
Activity::addMessage('book_delete', 0, $book->name);
Activity::addMessage('book_delete', $book->name);
if ($book->cover) {
$this->imageRepo->destroyImage($book->cover);