diff options
author | Vitaly Takmazov | 2018-04-12 00:41:57 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-12 00:41:57 +0300 |
commit | 97ffb90f765078aca3e4d6d173a6c93182d9165c (patch) | |
tree | 7e9c985d6b682522905c1ef63ec5cea63cbaf72a /juick-server-jdbc/src/main | |
parent | e319dda17260334262603df9cdc18fe52d6c164b (diff) |
subscription mark all comments read
Diffstat (limited to 'juick-server-jdbc/src/main')
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |