diff options
author | Vitaly Takmazov | 2016-08-05 09:59:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-08-05 09:59:03 +0300 |
commit | 9f2901c0ad230b272c6bbae192e88d939cbb30f8 (patch) | |
tree | e6708d5d777b3d3e21a106716ead4fad6ec1b88a /juick-core/src | |
parent | d6d55af49e57a9950d3f646dea8e3307ac6c6987 (diff) |
filter tags subscriptions on bl
Diffstat (limited to 'juick-core/src')
-rw-r--r-- | juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java | 4 |
1 files changed, 3 insertions, 1 deletions
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<User> getSubscribedUsers(JdbcTemplate sql, int uid, int mid) { + User author = MessagesQueries.getMessageAuthor(sql, mid); List<User> userids = UserQueries.getUserReaders(sql, uid); Set<Integer> set = new HashSet<>(); set.addAll(userids.stream().map(User::getUID).collect(Collectors.toList())); List<Integer> tags = MessagesQueries.getMessageTagsIDs(sql, mid); if (tags.size() > 0) { List<Integer> 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)); |