Ignore:
Timestamp:
09/03/21 18:34:05 (3 years ago)
Author:
KostaFortumanov <kfortumanov@…>
Branches:
master
Children:
5306751
Parents:
f8007b3
Message:

Mali promeni vo azuriranje sredstva

File:
1 edited

Legend:

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

    rf8007b3 r194776a  
    105105    }
    106106
    107     @RequestMapping("/addFunds")
     107    @RequestMapping(value = "/addFunds", method = RequestMethod.POST)
    108108    public String addFunds(@RequestParam Long postid,
    109109                           @RequestParam String type,
     
    111111
    112112        DonationPost post = donationPostService.getById(postid);
    113         FundsCollected funds = new FundsCollected(type, amount);
    114         fundsCollectedService.save(funds);
    115 
    116         post.getFundsCollected().add(funds);
    117         donationPostService.save(post);
     113        if(post.getUser().getUsername().equals(SecurityContextHolder.getContext().getAuthentication().getName())) {
     114            FundsCollected funds = new FundsCollected(type, amount);
     115            fundsCollectedService.save(funds);
     116            post.getFundsCollected().add(funds);
     117            donationPostService.save(post);
     118        }
    118119        return "redirect:/myPosts";
    119120    }
Note: See TracChangeset for help on using the changeset viewer.