aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-04 15:39:01 +0300
committerGravatar Vitaly Takmazov2018-07-04 15:39:01 +0300
commit2e563514d4d3bd5f6ae325376d6c47671e9a474b (patch)
tree50bba12f26e92a72e2a2801bfe52a37cc7c5fc36
parente6356edd22ad8962a0dca7a0ca819f6b4de73f3b (diff)
do not show join all replies in CTEs
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java3
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java3
2 files changed, 4 insertions, 2 deletions
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 d68ef8dd..6c13190f 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -842,7 +842,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"WHERE replies.message_id = :mid " +
"AND EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = replies.user_id) " +
"UNION ALL SELECT replies.reply_id, replies.user_id FROM replies " +
- "INNER JOIN banned ON banned.reply_id = replies.replyto ) " +
+ "INNER JOIN banned ON banned.reply_id = replies.replyto " +
+ "WHERE replies.message_id = :mid) " +
"SELECT replies.message_id as mid, replies.reply_id, replies.replyto, " +
"replies.user_id, users.nick, users.banned, " +
"replies.ts, " +
diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index eca0c264..bc448151 100644
--- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
@@ -458,7 +458,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
"WHERE replies.message_id = :mid " +
"AND EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = replies.user_id) " +
"UNION ALL SELECT replies.reply_id, replies.user_id FROM replies " +
- "INNER JOIN banned ON banned.reply_id = replies.replyto ) " +
+ "INNER JOIN banned ON banned.reply_id = replies.replyto " +
+ "WHERE replies.message_id = :mid) " +
"SELECT COUNT(reply_id) from replies " +
"WHERE replies.message_id = :mid " +
"AND replies.reply_id = :rid " +