mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-18 14:21:05 +00:00
Entity Repo & Controller Refactor (#1690)
* Started mass-refactoring of the current entity repos * Rewrote book tree logic - Now does two simple queries instead of one really complex one. - Extracted logic into its own class. - Remove model-level akward union field listing. - Logic now more readable than being large separate query and compilation functions. * Extracted and split book sort logic * Finished up Book controller/repo organisation * Refactored bookshelves controllers and repo parts * Fixed issues found via phpunit * Refactored Chapter controller * Updated Chapter export controller * Started Page controller/repo refactor * Refactored another chunk of PageController * Completed initial pagecontroller refactor pass * Fixed tests and continued reduction of old repos * Removed old page remove and further reduced entity repo * Removed old entity repo, split out page controller * Ran phpcbf and split out some page content methods * Tidied up some EntityProvider elements * Fixed issued caused by viewservice change
This commit is contained in:
parent
7cd956b24b
commit
31f5786e01
72 changed files with 2705 additions and 2751 deletions
app/Http/Controllers
|
@ -202,7 +202,7 @@ class UserController extends Controller
|
|||
}
|
||||
|
||||
$user->save();
|
||||
$this->showSuccessNotification( trans('settings.users_edit_success'));
|
||||
$this->showSuccessNotification(trans('settings.users_edit_success'));
|
||||
|
||||
$redirectUrl = userCan('users-manage') ? '/settings/users' : ('/settings/users/' . $user->id);
|
||||
return redirect($redirectUrl);
|
||||
|
@ -236,17 +236,17 @@ class UserController extends Controller
|
|||
$user = $this->userRepo->getById($id);
|
||||
|
||||
if ($this->userRepo->isOnlyAdmin($user)) {
|
||||
$this->showErrorNotification( trans('errors.users_cannot_delete_only_admin'));
|
||||
$this->showErrorNotification(trans('errors.users_cannot_delete_only_admin'));
|
||||
return redirect($user->getEditUrl());
|
||||
}
|
||||
|
||||
if ($user->system_name === 'public') {
|
||||
$this->showErrorNotification( trans('errors.users_cannot_delete_guest'));
|
||||
$this->showErrorNotification(trans('errors.users_cannot_delete_guest'));
|
||||
return redirect($user->getEditUrl());
|
||||
}
|
||||
|
||||
$this->userRepo->destroy($user);
|
||||
$this->showSuccessNotification( trans('settings.users_delete_success'));
|
||||
$this->showSuccessNotification(trans('settings.users_delete_success'));
|
||||
|
||||
return redirect('/settings/users');
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ class UserController extends Controller
|
|||
$user = $this->userRepo->getById($id);
|
||||
|
||||
$userActivity = $this->userRepo->getActivity($user);
|
||||
$recentlyCreated = $this->userRepo->getRecentlyCreated($user, 5, 0);
|
||||
$recentlyCreated = $this->userRepo->getRecentlyCreated($user, 5);
|
||||
$assetCounts = $this->userRepo->getAssetCounts($user);
|
||||
|
||||
return view('users.profile', [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue