From 2d5dfc2be23bbab03f8cba285d9255833d9b798c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 1 Dec 2016 19:49:19 +0300 Subject: juick-server: fix popular query --- juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'juick-server') 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 7ca49ea9..bd044866 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -513,7 +513,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ .addValue("before", before); return getNamedParameterJdbcTemplate().queryForList( - "SELECT m.message_id FROM m.messages WHERE m.privacy > 0 " + + "SELECT m.message_id FROM messages m WHERE m.privacy > 0 " + (before > 0 ? " AND m.message_id < :before " : "") + " AND m.popular > 0 AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " + -- cgit v1.2.3