From be91c5f5771282f2798cb687f915b0df44eaa59e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 20 Mar 2018 11:36:13 +0300 Subject: jdbc: no more notifications from banned users --- .../java/com/juick/service/SubscriptionServiceImpl.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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 eb3f79a9..77735b0c 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 @@ -17,6 +17,7 @@ package com.juick.service; +import com.juick.Message; import com.juick.Tag; import com.juick.User; import com.juick.server.helpers.NotifyOpts; @@ -27,6 +28,7 @@ import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; +import javax.annotation.Nonnull; import javax.inject.Inject; import java.util.Collections; import java.util.HashSet; @@ -102,15 +104,17 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Transactional(readOnly = true) @Override - public List getUsersSubscribedToComments(final int mid, final int ignore_uid) { + public List getUsersSubscribedToComments(@Nonnull final Message msg, @Nonnull final Message reply) { List userids = getJdbcTemplate().queryForList( "SELECT suser_id FROM subscr_messages WHERE message_id=? AND suser_id!=?", Integer.class, - mid, ignore_uid); - - if (!userids.isEmpty()) - return userService.getUsersByID(userids); + msg.getMid(), reply.getUser().getUid()); + if (!userids.isEmpty()) { + return userService.getUsersByID(userids.stream() + .filter(u -> !userService.isInBLAny(u, reply.getUser().getUid())) + .collect(Collectors.toList())); + } return Collections.emptyList(); } -- cgit v1.2.3