aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-21 17:12:20 +0300
committerGravatar Vitaly Takmazov2016-11-21 17:12:20 +0300
commit8b267a3b630f5843623801f42eb90d0ad6a9d849 (patch)
treec907d38ff0e86d8854048a2c02058b0d13747c24 /juick-server/src/main/java/com/juick
parent1115ff7cacecc75891203c6a82926954820d5475 (diff)
juick-server: fix subscribed users query also in service implementation
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r--juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index f6ecb658..7e6b9d0a 100644
--- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -64,13 +64,11 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip
set.addAll(userids.stream().map(User::getUid).collect(Collectors.toList()));
List<Integer> tags = messagesService.getMessageTagsIDs(mid);
if (tags.size() > 0) {
- List<Integer> tagUsers = getJdbcTemplate().queryForList(
- "SELECT suser_id FROM subscr_tags " +
- "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());
+ String tagsStr = StringUtils.arrayToCommaDelimitedString(tags.toArray());
+ List<Integer> tagUsers = getJdbcTemplate().queryForList("SELECT suser_id FROM subscr_tags " +
+ "WHERE tag_id IN (" + tagsStr + ") AND suser_id!=? " +
+ " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)" +
+ " AND suser_id NOT IN (SELECT user_id FROM bl_tags WHERE tag_id IN (" + tagsStr + "))", Integer.class, uid, author.getUid());
set.addAll(tagUsers);
}
return userService.getUsersByID(new ArrayList<>(set));