diff --git a/src/main/java/de/thm/arsnova/controller/v2/CommentController.java b/src/main/java/de/thm/arsnova/controller/v2/CommentController.java index 29e21a494c23c534210cd094a24ff1a673b24084..0f9f6e12fa0cf9c6e981c17de596d27e3e242412 100644 --- a/src/main/java/de/thm/arsnova/controller/v2/CommentController.java +++ b/src/main/java/de/thm/arsnova/controller/v2/CommentController.java @@ -120,11 +120,7 @@ public class CommentController extends PaginationController { de.thm.arsnova.entities.Comment commentV3 = fromV2Migrator.migrate(comment); Room roomV3 = roomService.getByShortId(roomShortId); commentV3.setRoomId(roomV3.getId()); - if (commentService.save(commentV3)) { - return; - } - - throw new BadRequestException(); + commentService.create(commentV3); } @ApiOperation(value = "Deletes a Comment", diff --git a/src/main/java/de/thm/arsnova/services/CommentService.java b/src/main/java/de/thm/arsnova/services/CommentService.java index 0720538f6df26caae94d0c7af8e8ac56ebd6b25a..021499325c7e00fdf8615c6e84032bfbdc47c662 100644 --- a/src/main/java/de/thm/arsnova/services/CommentService.java +++ b/src/main/java/de/thm/arsnova/services/CommentService.java @@ -7,8 +7,6 @@ import java.io.IOException; import java.util.List; public interface CommentService extends EntityService<Comment> { - boolean save(Comment comment); - int count(String roomId); CommentReadingCount countRead(String roomId, String username); diff --git a/src/main/java/de/thm/arsnova/services/CommentServiceImpl.java b/src/main/java/de/thm/arsnova/services/CommentServiceImpl.java index 3ca7b5aec3f9485794111016cbd6b6e2a542458a..e48c848528f5616e490603fd3afd833e7217c0ad 100644 --- a/src/main/java/de/thm/arsnova/services/CommentServiceImpl.java +++ b/src/main/java/de/thm/arsnova/services/CommentServiceImpl.java @@ -55,7 +55,7 @@ public class CommentServiceImpl extends DefaultEntityServiceImpl<Comment> implem @Override @PreAuthorize("isAuthenticated()") - public boolean save(final Comment comment) { + public void prepareCreate(final Comment comment) { final Room room = roomRepository.findOne(comment.getRoomId()); final ClientAuthentication user = userService.getCurrentUser(); comment.setCreatorId(user.getId()); @@ -63,14 +63,7 @@ public class CommentServiceImpl extends DefaultEntityServiceImpl<Comment> implem if (comment.getTimestamp() == null) { comment.setTimestamp(new Date()); } - final Comment result = super.create(comment); - - if (null != result) { - final NewCommentEvent event = new NewCommentEvent(this, room, result); - this.publisher.publishEvent(event); - return true; - } - return false; + /* TODO: fire event */ } @Override