aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-12 00:41:57 +0300
committerGravatar Vitaly Takmazov2018-04-12 00:41:57 +0300
commit97ffb90f765078aca3e4d6d173a6c93182d9165c (patch)
tree7e9c985d6b682522905c1ef63ec5cea63cbaf72a /juick-server-jdbc/src/main/java/com
parente319dda17260334262603df9cdc18fe52d6c164b (diff)
subscription mark all comments read
Diffstat (limited to 'juick-server-jdbc/src/main/java/com')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java8
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;
}