From 2109acda68cce512b7b2dc80f8243651a213374d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Oct 2018 00:13:54 +0300 Subject: Do not duplicate external replies --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'juick-server/src/main/java/com/juick/service') diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java index 0b0a11ae..4831c9d1 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -1106,4 +1106,10 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return jdbcTemplate.update("UPDATE replies SET reply_uri=?, html=1 WHERE message_id=? AND reply_id=?", replyUri.toASCIIString(), reply.getMid(), reply.getRid()) > 0; } + + @Override + public boolean replyExists(URI replyUri) { + return jdbcTemplate.queryForList("SELECT reply_id FROM replies WHERE reply_uri=?", + Integer.class, replyUri.toASCIIString()).size() > 0; + } } -- cgit v1.2.3