From 9f2901c0ad230b272c6bbae192e88d939cbb30f8 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 5 Aug 2016 09:59:03 +0300 Subject: filter tags subscriptions on bl --- juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'juick-core/src/main/java') diff --git a/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java b/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java index a0b91447..cedd2fd4 100644 --- a/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java +++ b/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java @@ -31,13 +31,15 @@ public class SubscriptionsQueries { } public static List getSubscribedUsers(JdbcTemplate sql, int uid, int mid) { + User author = MessagesQueries.getMessageAuthor(sql, mid); List userids = UserQueries.getUserReaders(sql, uid); Set set = new HashSet<>(); set.addAll(userids.stream().map(User::getUID).collect(Collectors.toList())); List tags = MessagesQueries.getMessageTagsIDs(sql, mid); if (tags.size() > 0) { List tagUsers = sql.queryForList("SELECT suser_id FROM subscr_tags " + - "WHERE tag_id IN (" + StringUtils.arrayToCommaDelimitedString(tags.toArray()) + ") AND suser_id!=" + uid, Integer.class); + "WHERE tag_id IN (" + StringUtils.arrayToCommaDelimitedString(tags.toArray()) + ") AND suser_id!=? " + + " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)", Integer.class, uid, author.getUID()); set.addAll(tagUsers); } return UserQueries.getUsersByID(sql, new ArrayList<>(set)); -- cgit v1.2.3