From 473c9dcec4ff03baf9940bc980371692e369ead2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 24 Apr 2018 22:22:36 +0300 Subject: server: allow like reaction --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'juick-server-jdbc/src/main/java/com/juick') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java index 0ca30904..8554b35f 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -253,13 +253,11 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Transactional @Override public RecommendStatus likeMessage(int mid, int vuid, int reactionId) throws IllegalArgumentException { - if(reactionId == Reaction.LIKE) throw new IllegalArgumentException("this reaction type does not support here"); - - boolean wasAdded = getJdbcTemplate() - .update("INSERT INTO favorites(user_id, message_id, ts, like_id ) VALUES (?, ?, NOW(), ?)", vuid, mid, reactionId) == 1; - if (wasAdded) { - return RecommendStatus.Added; - } + boolean wasAdded = getJdbcTemplate() + .update("INSERT INTO favorites(user_id, message_id, ts, like_id ) VALUES (?, ?, NOW(), ?)", vuid, mid, reactionId) == 1; + if (wasAdded) { + return RecommendStatus.Added; + } return RecommendStatus.Error; } -- cgit v1.2.3