Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Castopod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ad Aures
Castopod
Commits
c1ec98c9
Commit
c1ec98c9
authored
1 year ago
by
Yassine Doghri
Browse files
Options
Downloads
Patches
Plain Diff
fix(persons): delete person avatar when deleting a person
fixes
#419
parent
30a34738
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Admin/Controllers/PersonController.php
+6
-0
6 additions, 0 deletions
modules/Admin/Controllers/PersonController.php
with
6 additions
and
0 deletions
modules/Admin/Controllers/PersonController.php
+
6
−
0
View file @
c1ec98c9
...
...
@@ -14,6 +14,7 @@ use App\Entities\Person;
use
App\Models\PersonModel
;
use
CodeIgniter\Exceptions\PageNotFoundException
;
use
CodeIgniter\HTTP\RedirectResponse
;
use
Modules\Media\Models\MediaModel
;
class
PersonController
extends
BaseController
{
...
...
@@ -151,6 +152,11 @@ class PersonController extends BaseController
public
function
delete
():
RedirectResponse
{
if
(
$this
->
person
->
avatar_id
!==
null
)
{
// delete avatar to prevent collision if recreating person
(
new
MediaModel
())
->
deleteMedia
(
$this
->
person
->
avatar
);
}
(
new
PersonModel
())
->
delete
(
$this
->
person
->
id
);
return
redirect
()
->
route
(
'person-list'
)
...
...
This diff is collapsed.
Click to expand it.
Yassine Doghri
@yassinedoghri
mentioned in commit
9899870e
·
1 year ago
mentioned in commit
9899870e
mentioned in commit 9899870e28e7c5b74746d0ee095d4eb331d049fe
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment