1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-27 06:01:54 +03: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:
Dan Brown
2020-11-07 22:37:27 +00:00
parent 4824ef2760
commit c157dc3490
19 changed files with 76 additions and 73 deletions

View File

@ -1,6 +1,7 @@
<?php namespace BookStack\Http\Controllers;
use Activity;
use BookStack\Actions\ActivityType;
use BookStack\Entities\Managers\BookContents;
use BookStack\Entities\Managers\PageContent;
use BookStack\Entities\Managers\PageEditActivity;
@ -107,7 +108,6 @@ class PageController extends Controller
$this->checkOwnablePermission('page-create', $draftPage->getParent());
$page = $this->pageRepo->publishDraft($draftPage, $request->all());
Activity::add($page, 'page_create', $draftPage->book->id);
return redirect($page->getUrl());
}
@ -224,7 +224,6 @@ class PageController extends Controller
$this->checkOwnablePermission('page-update', $page);
$this->pageRepo->update($page, $request->all());
Activity::add($page, 'page_update', $page->book->id);
return redirect($page->getUrl());
}
@ -304,11 +303,9 @@ class PageController extends Controller
{
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
$this->checkOwnablePermission('page-delete', $page);
$parent = $page->getParent();
$book = $page->book;
$parent = $page->chapter ?? $book;
$this->pageRepo->destroy($page);
Activity::add($page, 'page_delete', $page->book_id);
return redirect($parent->getUrl());
}
@ -393,7 +390,6 @@ class PageController extends Controller
return redirect()->back();
}
Activity::add($page, 'page_move', $page->book->id);
$this->showSuccessNotification(trans('entities.pages_move_success', ['parentName' => $parent->name]));
return redirect($page->getUrl());
}
@ -438,8 +434,6 @@ class PageController extends Controller
return redirect()->back();
}
Activity::add($pageCopy, 'page_create', $pageCopy->book->id);
$this->showSuccessNotification(trans('entities.pages_copy_success'));
return redirect($pageCopy->getUrl());
}