mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-20 23:19:38 +00:00
Organised activity types and moved most to repos
Repos are generally better since otherwise we end up duplicating things between front-end and API. Types moved to by CONST values within a class for better visibilty of usage and listing of types.
This commit is contained in:
parent
4824ef2760
commit
c157dc3490
19 changed files with 76 additions and 73 deletions
app/Http/Controllers
|
@ -1,12 +1,12 @@
|
|||
<?php namespace BookStack\Http\Controllers;
|
||||
|
||||
use Activity;
|
||||
use BookStack\Actions\ActivityType;
|
||||
use BookStack\Entities\Managers\BookContents;
|
||||
use BookStack\Entities\Bookshelf;
|
||||
use BookStack\Entities\Managers\EntityContext;
|
||||
use BookStack\Entities\Repos\BookRepo;
|
||||
use BookStack\Exceptions\ImageUploadException;
|
||||
use BookStack\Exceptions\NotifyException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Throwable;
|
||||
|
@ -18,9 +18,6 @@ class BookController extends Controller
|
|||
protected $bookRepo;
|
||||
protected $entityContextManager;
|
||||
|
||||
/**
|
||||
* BookController constructor.
|
||||
*/
|
||||
public function __construct(EntityContext $entityContextManager, BookRepo $bookRepo)
|
||||
{
|
||||
$this->bookRepo = $bookRepo;
|
||||
|
@ -97,11 +94,10 @@ class BookController extends Controller
|
|||
|
||||
$book = $this->bookRepo->create($request->all());
|
||||
$this->bookRepo->updateCoverImage($book, $request->file('image', null));
|
||||
Activity::add($book, 'book_create', $book->id);
|
||||
|
||||
if ($bookshelf) {
|
||||
$bookshelf->appendBook($book);
|
||||
Activity::add($bookshelf, 'bookshelf_update');
|
||||
Activity::add($bookshelf, ActivityType::BOOKSHELF_UPDATE);
|
||||
}
|
||||
|
||||
return redirect($book->getUrl());
|
||||
|
@ -162,8 +158,6 @@ class BookController extends Controller
|
|||
$resetCover = $request->has('image_reset');
|
||||
$this->bookRepo->updateCoverImage($book, $request->file('image', null), $resetCover);
|
||||
|
||||
Activity::add($book, 'book_update', $book->id);
|
||||
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
|
||||
|
@ -187,7 +181,6 @@ class BookController extends Controller
|
|||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$this->checkOwnablePermission('book-delete', $book);
|
||||
|
||||
Activity::add($book, 'book_delete', $book->id);
|
||||
$this->bookRepo->destroy($book);
|
||||
|
||||
return redirect('/books');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue