aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-12 19:12:58 +0300
committerGravatar Vitaly Takmazov2018-08-12 19:12:58 +0300
commitc0ac4aa5824b45ff9543f60c648625869b11b1a3 (patch)
tree6e5b5c2eb436b58f32a0a07964a24af9cff6de2f /juick-server/src/main/java/com/juick
parentbabb3a50a1c7e6101980a9577364b169b5c6654c (diff)
do not show banned users in my feed from recommendations
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java12
1 files changed, 9 insertions, 3 deletions
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 054503c1..ba721eea 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -517,18 +517,24 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
(before > 0 ?
" message_id < :before AND " : StringUtils.EMPTY) +
" (privacy >= 0 OR (privacy >= -2 AND privacy <= -1" +
- " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id)))) " +
+ " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id))) " +
+ " AND NOT EXISTS (SELECT 1 FROM bl_tags bt WHERE bt.tag_id IN " +
+ "(SELECT tag_id FROM messages_tags WHERE message_id = messages.message_id) and :uid = bt.user_id))" +
" UNION " +
" (SELECT message_id FROM messages WHERE user_id=:uid " +
(before > 0 ?
" AND message_id < :before " : StringUtils.EMPTY) +
(recommended ?
") UNION " +
- " (SELECT f.message_id as message_id FROM favorites f WHERE " +
+ " (SELECT f.message_id as message_id FROM favorites f INNER JOIN messages ON " +
+ "f.message_id=messages.message_id WHERE " +
"EXISTS (SELECT 1 FROM subscr_users s WHERE s.suser_id = :uid and f.user_id = s.user_id)" +
(before > 0 ?
" AND f.message_id < :before " : StringUtils.EMPTY) : StringUtils.EMPTY) +
- ") ORDER BY message_id DESC LIMIT 20",
+ " AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid and b.bl_user_id = messages.user_id)" +
+ " AND NOT EXISTS (SELECT 1 FROM bl_tags bt WHERE bt.tag_id IN " +
+ "(SELECT tag_id FROM messages_tags WHERE message_id = messages.message_id) and :uid = bt.user_id)) " +
+ "ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);