From 90d77f71c53a6349c1fb3bcf81d6f9a2a630b3e6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 16 Apr 2018 17:17:03 +0300 Subject: server: mark comments from blacklisted users as read --- .../src/main/java/com/juick/service/SubscriptionServiceImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'juick-server-jdbc/src/main/java/com/juick') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 64143c32..7626651a 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -91,10 +91,15 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip } return userService.getUsersByID(set); } + @Override + public List getUsersSubscribedToComments(@Nonnull final Message msg, @Nonnull final Message reply) { + return getUsersSubscribedToComments(msg, reply, false); + } @Transactional(readOnly = true) @Override - public List getUsersSubscribedToComments(@Nonnull final Message msg, @Nonnull final Message reply) { + public List getUsersSubscribedToComments(@Nonnull final Message msg, @Nonnull final Message reply, + boolean blacklisted) { List userids = getJdbcTemplate().queryForList( "SELECT suser_id FROM subscr_messages WHERE message_id=? AND suser_id!=?", Integer.class, @@ -102,7 +107,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip if (!userids.isEmpty()) { return userService.getUsersByID(userids.stream() - .filter(u -> !userService.isInBLAny(u, reply.getUser().getUid())) + .filter(u -> blacklisted || !userService.isInBLAny(u, reply.getUser().getUid())) .collect(Collectors.toList())); } return Collections.emptyList(); -- cgit v1.2.3