aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/server/MessagesQueries.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/juick/server/MessagesQueries.java b/src/main/java/com/juick/server/MessagesQueries.java
index 880e94e2..a0242543 100644
--- a/src/main/java/com/juick/server/MessagesQueries.java
+++ b/src/main/java/com/juick/server/MessagesQueries.java
@@ -446,14 +446,16 @@ public class MessagesQueries {
}
}
- public static List<Integer> getPopular(JdbcTemplate sql, int before) {
+ public static List<Integer> getPopular(JdbcTemplate sql, int visitor_uid, int before) {
if (before > 0) {
return sql.queryForList("SELECT message_id FROM messages WHERE message_id<? AND privacy>0 " +
- "AND popular>0 ORDER BY message_id DESC LIMIT 20", Integer.class, before);
+ "AND popular>0 AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) " +
+ "ORDER BY message_id DESC LIMIT 20", Integer.class, before, visitor_uid);
} else {
return sql.queryForList("SELECT message_id FROM messages WHERE privacy>0 " +
- "AND popular>0 ORDER BY message_id DESC LIMIT 20", Integer.class);
+ "AND popular>0 AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) " +
+ "ORDER BY message_id DESC LIMIT 20", Integer.class, visitor_uid);
}
}
@@ -461,11 +463,13 @@ public class MessagesQueries {
if (before > 0) {
return sql.queryForList("SELECT message_id FROM messages WHERE message_id<? AND (privacy>0 OR user_id=?) " +
"AND attach IS NOT NULL AND user_id NOT IN (SELECT id from users WHERE banned=1) " +
- "ORDER BY message_id DESC LIMIT 20", new Object[]{before, visitor_uid}, Integer.class);
+ "AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) " +
+ "ORDER BY message_id DESC LIMIT 20", Integer.class, before, visitor_uid, visitor_uid);
} else {
return sql.queryForList("SELECT message_id FROM messages WHERE (privacy>0 OR user_id=?) " +
"AND attach IS NOT NULL AND user_id NOT IN (SELECT id from users WHERE banned=1) " +
- "ORDER BY message_id DESC LIMIT 20", new Object[]{visitor_uid}, Integer.class);
+ "AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) " +
+ "ORDER BY message_id DESC LIMIT 20", Integer.class, visitor_uid, visitor_uid);
}
}