aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-09-18 11:43:32 +0300
committerGravatar Vitaly Takmazov2019-09-18 11:43:32 +0300
commit3626c982d7444ad4606f0a7723538614ddfb5c77 (patch)
tree8254d257d8609ae47bf9c30dcc3ad738fe1c7701 /src/main
parent32c7f35bda7ed3bdad93db4cce0dd17e7f48c3bd (diff)
Fix createReply logic
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index 099934ab..95d5d1bf 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -185,12 +185,12 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Override
public int createReply(final int mid, final int rid, final User user, final String txt, final String attachment) {
int ridnew = getReplyIDIncrement(mid, user.getUid());
- Timestamp ts = Timestamp.from(Instant.now());
- getJdbcTemplate().update("INSERT INTO replies(message_id, reply_id, user_id, replyto, attach, txt, ts, updated_at, user_uri) " +
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
- mid, ridnew, user.getUid(), rid, attachment, txt, ts, ts, user.getUri().toASCIIString());
-
if (ridnew > 0) {
+ Timestamp ts = Timestamp.from(Instant.now());
+ getJdbcTemplate().update("INSERT INTO replies(message_id, reply_id, user_id, replyto, attach, txt, ts, updated_at, user_uri) " +
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ mid, ridnew, user.getUid(), rid, attachment, txt, ts, ts, user.getUri().toASCIIString());
+
getJdbcTemplate().update(
"UPDATE messages SET replies = replies + 1, updated=? WHERE message_id = ?",
ts, mid);