Ignore:
Timestamp:
09/04/21 11:14:25 (3 years ago)
Author:
NikolaCenevski <cenevskinikola@…>
Branches:
master
Children:
ab49338
Parents:
194776a
Message:

Dodadeno posts to be approved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/charitable/controller/DonationPostController.java

    r194776a r5306751  
    7373        post.setDateDue(dateDue);
    7474        post.setBankAccount(bankAccount);
     75        post.setApproved(false);
    7576
    7677        List<String> phoneNumbers = Arrays.asList(telekom, a1);
     
    123124    @RequestMapping("/album")
    124125    public String album(Model model) {
    125         List<DonationPost> postList = donationPostService.findAll();
     126        List<DonationPost> postList = donationPostService.findAllByApproved(true);
    126127        if (postList.size() == 0) {
    127128            model.addAttribute("noPosts", true);
     
    148149    }
    149150
    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//    }
    164165
    165166    @RequestMapping("/donate")
Note: See TracChangeset for help on using the changeset viewer.