- Timestamp:
- 09/04/21 11:14:25 (3 years ago)
- Branches:
- master
- Children:
- ab49338
- Parents:
- 194776a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/controller/DonationPostController.java
r194776a r5306751 73 73 post.setDateDue(dateDue); 74 74 post.setBankAccount(bankAccount); 75 post.setApproved(false); 75 76 76 77 List<String> phoneNumbers = Arrays.asList(telekom, a1); … … 123 124 @RequestMapping("/album") 124 125 public String album(Model model) { 125 List<DonationPost> postList = donationPostService.findAll ();126 List<DonationPost> postList = donationPostService.findAllByApproved(true); 126 127 if (postList.size() == 0) { 127 128 model.addAttribute("noPosts", true); … … 148 149 } 149 150 150 @RequestMapping("/deletePost")151 public String deletePost(@RequestParam Long postid) {152 DonationPost post = donationPostService.getById(postid);153 if (post.getUser().getUsername().equals(SecurityContextHolder.getContext().getAuthentication().getName())) {154 List<String> fileForDeletion = post.getPhotosForDeletion();155 for (String f : fileForDeletion) {156 File file = new File(f);157 file.delete();158 }159 donationPostService.delete(post);160 }161 162 return "redirect:/myPosts";163 }151 // @RequestMapping("/deletePost") 152 // public String deletePost(@RequestParam Long postid) { 153 // DonationPost post = donationPostService.getById(postid); 154 // if (post.getUser().getUsername().equals(SecurityContextHolder.getContext().getAuthentication().getName())) { 155 // List<String> fileForDeletion = post.getPhotosForDeletion(); 156 // for (String f : fileForDeletion) { 157 // File file = new File(f); 158 // file.delete(); 159 // } 160 // donationPostService.delete(post); 161 // } 162 // 163 // return "redirect:/myPosts"; 164 // } 164 165 165 166 @RequestMapping("/donate")
Note:
See TracChangeset
for help on using the changeset viewer.