@Valid @ModelAttribute PostDto postDto,
BindingResult result) throws NotFoundException {
postDto.setTopicId(topicId);
if (result.hasErrors()) {
JCUser currentUser = userService.getCurrentUser();
Topic topic = topicFetchService.get(topicId);
postDto.setTopicId(topicId);
Page<Post> postsPage = postService.getPosts(topic, page);
return new ModelAndView("topic/postList")
.addObject("viewList", locationService.getUsersViewing(topic))
.addObject("usersOnline", sessionRegistry.getAllPrincipals())
.addObject("postsPage", postsPage)
.addObject("topic", topic)
.addObject(POST_DTO, postDto)
.addObject("subscribed", topic.getSubscribers().contains(currentUser))
.addObject(BREADCRUMB_LIST, breadcrumbBuilder.getForumBreadcrumb(topic));
}
Post newbie = replyToTopicWithLockHandling(postDto, topicId);
lastReadPostService.markTopicAsRead(newbie.getTopic());