Skip to content

Commit

Permalink
fixed redirect on submit answer with AJAX
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed May 2, 2017
1 parent f74a6c6 commit 4a09c26
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,9 @@ public String replyAjax(@PathVariable String id, @PathVariable(required = false)
HttpServletRequest req, Model model) throws IOException {
Post showPost = pc.read(id);
Profile authUser = utils.getAuthUser(req);
if (!canEdit(showPost, authUser) || showPost == null) {
return "redirect:" + req.getRequestURI();
}
// add new answer
String errorMsg = "";
if (!showPost.isClosed() && !showPost.isReply()) {
if (showPost != null && !showPost.isClosed() && !showPost.isReply()) {
//create new answer
Reply answer = utils.populate(req, new Reply(), "body");
Map<String, String> error = utils.validate(answer);
Expand Down

0 comments on commit 4a09c26

Please sign in to comment.