Fix project deletion and page creation

This commit is contained in:
KennyTV 2020-08-04 13:05:39 +02:00
parent 3a73b62a2e
commit 5c0c5d014f
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -247,9 +247,10 @@ public class ProjectsController extends HangarController {
public RedirectView softDelete(@PathVariable String author, @PathVariable String slug, @RequestParam(required = false) String comment, RedirectAttributes ra, HttpServletRequest request) { public RedirectView softDelete(@PathVariable String author, @PathVariable String slug, @RequestParam(required = false) String comment, RedirectAttributes ra, HttpServletRequest request) {
ProjectData projectData = projectService.getProjectData(author, slug); ProjectData projectData = projectService.getProjectData(author, slug);
Visibility oldVisibility = projectData.getVisibility(); Visibility oldVisibility = projectData.getVisibility();
projectFactory.softDeleteProject(projectData, comment);
userActionLogService.project(request, LoggedActionType.PROJECT_VISIBILITY_CHANGE.with(ProjectContext.of(projectData.getProject().getId())), Visibility.SOFTDELETE.getName(), oldVisibility.getName()); userActionLogService.project(request, LoggedActionType.PROJECT_VISIBILITY_CHANGE.with(ProjectContext.of(projectData.getProject().getId())), Visibility.SOFTDELETE.getName(), oldVisibility.getName());
projectFactory.softDeleteProject(projectData, comment);
ra.addFlashAttribute("alertType", AlertType.SUCCESS); ra.addFlashAttribute("alertType", AlertType.SUCCESS);
ra.addFlashAttribute("alertMsg", "project.deleted");// TODO add old project name as msg arg ra.addFlashAttribute("alertMsg", "project.deleted");// TODO add old project name as msg arg
return new RedirectView(routeHelper.getRouteUrl("showHome")); return new RedirectView(routeHelper.getRouteUrl("showHome"));
@ -321,7 +322,7 @@ public class ProjectsController extends HangarController {
projectsTable.setDescription(description); projectsTable.setDescription(description);
projectDao.get().update(projectsTable); projectDao.get().update(projectsTable);
// TODO update icon handling // TODO update icon handling
userActionLogService.project(request, LoggedActionType.PROJECT_SETTINGS_CHANGED.with(ProjectContext.of(projectsTable.getId())), null, null); userActionLogService.project(request, LoggedActionType.PROJECT_SETTINGS_CHANGED.with(ProjectContext.of(projectsTable.getId())), "", "");
return new RedirectView(routeHelper.getRouteUrl("projects.show", author, slug)); // TODO implement save request controller return new RedirectView(routeHelper.getRouteUrl("projects.show", author, slug)); // TODO implement save request controller
} }