From 97ffb90f765078aca3e4d6d173a6c93182d9165c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 12 Apr 2018 00:41:57 +0300 Subject: subscription mark all comments read --- .../src/main/java/com/juick/service/SubscriptionServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'juick-server-jdbc') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java index d580f97a..64143c32 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -140,10 +140,12 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Transactional @Override - public boolean subscribeMessage(final int mid, final int vuid) { + public boolean subscribeMessage(final Message message, final User user) { try { - return getJdbcTemplate().update( - "INSERT INTO subscr_messages(suser_id, message_id) VALUES (?, ?)", vuid, mid) == 1; + boolean result = getJdbcTemplate().update( + "INSERT INTO subscr_messages(suser_id, message_id) VALUES (?, ?)", user.getUid(), message.getMid()) == 1; + messagesService.setLastReadComment(user, message.getMid(), message.getReplies()); + return result; } catch (DuplicateKeyException e) { return true; } -- cgit v1.2.3