aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java34
1 files changed, 7 insertions, 27 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index 8a0f9ecf7..b0e365f8c 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -790,35 +790,15 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
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 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,
- users.banned as usr_banned,
- messages.ts,
- messages.readonly,
- messages.privacy,
- 1.*messages.replies-COUNT(DISTINCT banned.reply_id) as replies,
- messages.attach,
- COUNT(DISTINCT favorites.user_id) AS likes,
- messages.hidden,
- '' as tags,
- messages.repliesby,
- COALESCE(messages.txt, '') txt, '' as q,
- messages.updated,
- 0 as to_uid,
- NULL as to_name,
- messages.updated_at,
- '' as m_user_uri,
- '' as to_uri,
- '' as msg_reply_uri,
- 0 as html,
+ WHERE replies.message_id IN (:ids)) SELECT messages.message_id, 0 as rid, 0 as replyto, messages.user_id,
+ users.nick, users.banned as usr_banned, messages.ts, messages.readonly, messages.privacy,
+ 1.*messages.replies-COUNT(DISTINCT banned.reply_id) as replies, messages.attach,
+ COUNT(DISTINCT favorites.user_id) AS likes, messages.hidden, '' as tags, messages.repliesby,
+ COALESCE(messages.txt, '') txt, '' as q, messages.updated, 0 as to_uid, NULL as to_name,
+ messages.updated_at, '' as m_user_uri, '' as to_uri, '' as msg_reply_uri, 0 as html,
(1.*messages.replies - subscr_messages.last_read_rid) as unread,
(SELECT CASE WHEN EXISTS(SELECT * from subscr_messages where message_id=messages.message_id and suser_id=:uid) THEN 1 ELSE 0 END) subscribed
- FROM messages
- INNER JOIN users ON messages.user_id=users.id LEFT JOIN subscr_messages
+ FROM messages INNER JOIN users ON messages.user_id=users.id LEFT JOIN subscr_messages
ON messages.message_id=subscr_messages.message_id AND subscr_messages.suser_id=:uid
LEFT JOIN favorites ON messages.message_id = favorites.message_id AND favorites.like_id=1
LEFT JOIN banned ON messages.message_id = banned.message_id