From 70963f3c8a616039a442362e778825f4fe85e4c5 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 29 Aug 2018 17:28:11 +0300 Subject: shadow banned users from recommendations list --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java') 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 913ee747..e2958112 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -423,10 +423,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Override public List getMessageRecommendations(final int mid) { return getJdbcTemplate().queryForList( - "SELECT DISTINCT users.nick FROM favorites INNER JOIN users " + - "ON (favorites.message_id = ? AND favorites.user_id = users.id) WHERE favorites.like_id=1", - new Object[]{mid}, - String.class); + "SELECT DISTINCT users.nick FROM favorites " + + "INNER JOIN users ON (favorites.message_id = ? AND favorites.user_id = users.id) " + + "INNER JOIN messages m ON favorites.message_id=m.message_id WHERE favorites.like_id=1 " + + "AND NOT EXISTS (SELECT 1 FROM bl_users WHERE " + + "(user_id = favorites.user_id AND bl_user_id = m.user_id) " + + "OR (user_id = m.user_id AND bl_user_id = favorites.user_id))", + String.class, mid); } @Transactional(readOnly = true) -- cgit v1.2.3