aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-28 13:58:49 +0300
committerGravatar Vitaly Takmazov2018-11-28 13:59:04 +0300
commit0fea66317d608cb0f67bb92695a40d100d504c8d (patch)
tree4437282173fb0bfb684e71afbb32cdbebaa70191 /src/main/java/com/juick/service
parentc822798998b72fd2dccd748438fbd8563e733485 (diff)
Fix infinite recursion while requesting message witout banned replies
Diffstat (limited to 'src/main/java/com/juick/service')
-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 1ae94463..f45ee351 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -851,16 +851,16 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "AND (EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = replies.user_id) "
+ "OR EXISTS (SELECT 1 from users u WHERE u.banned = 1 and u.id = replies.user_id and u.id <> :uid)) "
+ "UNION ALL SELECT replies.message_id, replies.reply_id FROM replies INNER JOIN banned "
- + "ON banned.reply_id = replies.replyto AND banned.message_id=replies.message_id "
+ + "ON banned.reply_id = replies.replyto AND replies.reply_id != replies.replyto AND banned.message_id=replies.message_id "
+ "WHERE replies.message_id IN (:ids)) "
+ "SELECT messages.message_id, 0 as rid, 0 as replyto, "
- + "messages.user_id,users.nick, 0 as banned, "
+ + "messages.user_id,users.nick, 0 as usr_banned, "
+ "messages.ts,"
+ "messages.readonly,messages.privacy, messages.replies-COUNT(DISTINCT banned.reply_id) as replies,"
+ "messages.attach,COUNT(DISTINCT favorites.user_id) AS likes,messages.hidden,"
+ "messages_txt.tags,messages_txt.repliesby, messages_txt.txt, '' as q, "
+ "messages.updated, 0 as to_uid, NULL as to_name, messages_txt.updated_at, '' as user_uri, "
- + "'' as to_uri, '' as reply_uri, 0 as html "
+ + "'' as to_uri, '' as msg_reply_uri, 0 as html "
+ "FROM (messages INNER JOIN messages_txt "
+ "ON messages.message_id=messages_txt.message_id) "
+ "INNER JOIN users ON messages.user_id=users.id "
@@ -869,10 +869,10 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "LEFT JOIN banned "
+ "ON messages.message_id = banned.message_id "
+ "WHERE messages.message_id IN (:ids) GROUP BY "
- + "messages.message_id, rid, replyto, messages.user_id, users.nick, banned, messages.ts, "
+ + "messages.message_id, rid, replyto, messages.user_id, users.nick, usr_banned, messages.ts, "
+ "messages.readonly, messages.privacy, messages.attach, messages.hidden, messages_txt.tags, "
+ "messages_txt.repliesby, messages_txt.txt, q, messages.updated, to_uid, to_name, updated_at, "
- + "user_uri, reply_uri, html",
+ + "user_uri, msg_reply_uri, html",
new MapSqlParameterSource("ids", mids)
.addValue("uid", visitor.getUid()),
new MessageMapper());