aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-jdbc/src/main')
-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;
}