/** * {@inheritDoc} */ @Override public Set<JCUser> getSubscribers() { return getTopic().getSubscribers(); }
/** * {@inheritDoc} */ @Override public void toggleTopicSubscription(Topic topic) { JCUser current = userService.getCurrentUser(); if (topic.userSubscribed(current)) { topic.getSubscribers().remove(current); } else { topic.getSubscribers().add(current); } topicDao.saveOrUpdate(topic); }
.addObject("topic", topic) .addObject(POST_DTO, postDto) .addObject("subscribed", topic.getSubscribers().contains(currentUser)) .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getForumBreadcrumb(topic));
.addObject("topic", topic) .addObject(POST_DTO, postDto) .addObject("subscribed", topic.getSubscribers().contains(currentUser)) .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getForumBreadcrumb(topic)) .addObject("markAsReadLink", topic.getMarkAsReadUrl(currentUser, page).orNull());
/** * {@inheritDoc} */ @Override public PostComment addComment(Long postId, Map<String, String> attributes, String body) throws NotFoundException { Post targetPost = get(postId); JCUser currentUser = userService.getCurrentUser(); assertCommentAllowed(targetPost.getTopic()); PostComment comment = new PostComment(); comment.putAllAttributes(attributes); comment.setBody(body); comment.setCreationDate(new DateTime(System.currentTimeMillis())); comment.setAuthor(currentUser); if (currentUser.isAutosubscribe()) { targetPost.getTopic().getSubscribers().add(currentUser); } targetPost.addComment(comment); getDao().saveOrUpdate(targetPost); /** * Notify subscribers of topic if comment added */ notificationService.subscribedEntityChanged(targetPost.getTopic()); return comment; }