aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-core/src')
-rw-r--r--juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java4
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));