diff options
author | Vitaly Takmazov | 2015-10-31 00:36:58 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2015-10-31 00:37:43 +0300 |
commit | 5f981ff945d7bad508d0fb56d037bfe3dccd0cf3 (patch) | |
tree | 28516f8162a90eb62c1cb69dac9daae85b4a41fd /src/main/java/com | |
parent | 96b4a36d13225ed81aff46b29721678480055ee5 (diff) |
Do not show banned users in feed
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/server/MessagesQueries.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/MessagesQueries.java b/src/main/java/com/juick/server/MessagesQueries.java index 17e9f832..d8d4887d 100644 --- a/src/main/java/com/juick/server/MessagesQueries.java +++ b/src/main/java/com/juick/server/MessagesQueries.java @@ -416,21 +416,29 @@ public class MessagesQueries { try { if (visitor_uid > 1) { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND hidden=0 AND (privacy>0 OR user_id=?) AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND hidden=0" + + " AND (privacy>0 OR user_id=?) AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?)" + + " AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, before); stmt.setInt(2, visitor_uid); stmt.setInt(3, visitor_uid); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE hidden=0 AND (privacy>0 OR user_id=?) AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE hidden=0" + + " AND (privacy>0 OR user_id=?)" + + " AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?)" + + " AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, visitor_uid); stmt.setInt(2, visitor_uid); } } else { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND hidden=0 AND privacy>0 ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<?" + + " AND hidden=0 AND privacy>0 AND user_id NOT IN (SELECT id from users WHERE banned=1) " + + " ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, before); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE hidden=0 AND privacy>0 ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE hidden=0 AND privacy>0" + + " AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); } } |