mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Simplified activity facade interface
Also cleaned up any other bits along the way.
This commit is contained in:
@@ -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);
|
||||
|
@@ -212,7 +212,7 @@ class BookshelfController extends Controller
|
||||
{
|
||||
$shelf = $this->entityRepo->getEntityBySlug('bookshelf', $slug); /** @var $shelf Bookshelf */
|
||||
$this->checkOwnablePermission('bookshelf-delete', $shelf);
|
||||
Activity::addMessage('bookshelf_delete', 0, $shelf->name);
|
||||
Activity::addMessage('bookshelf_delete', $shelf->name);
|
||||
|
||||
if ($shelf->cover) {
|
||||
$this->imageRepo->destroyImage($shelf->cover);
|
||||
|
@@ -143,7 +143,7 @@ class ChapterController extends Controller
|
||||
$chapter = $this->entityRepo->getEntityBySlug('chapter', $chapterSlug, $bookSlug);
|
||||
$book = $chapter->book;
|
||||
$this->checkOwnablePermission('chapter-delete', $chapter);
|
||||
Activity::addMessage('chapter_delete', $book->id, $chapter->name);
|
||||
Activity::addMessage('chapter_delete', $chapter->name, $book->id);
|
||||
$this->entityRepo->destroyChapter($chapter);
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@
|
||||
namespace BookStack\Http\Controllers;
|
||||
|
||||
use BookStack\Auth\User;
|
||||
use BookStack\Entities\Entity;
|
||||
use BookStack\Facades\Activity;
|
||||
use BookStack\Ownable;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
|
@@ -358,7 +358,7 @@ class PageController extends Controller
|
||||
$this->checkOwnablePermission('page-delete', $page);
|
||||
$this->pageRepo->destroyPage($page);
|
||||
|
||||
Activity::addMessage('page_delete', $book->id, $page->name);
|
||||
Activity::addMessage('page_delete', $page->name, $book->id);
|
||||
$this->showSuccessNotification( trans('entities.pages_delete_success'));
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
|
Reference in New Issue
Block a user