aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-04 17:53:09 +0300
committerGravatar Vitaly Takmazov2018-07-04 17:53:09 +0300
commitea412bd40ab3576ac752c30705a13c0a7dfac27b (patch)
tree2d0fc44c3d0b1c6268707f1666fabf67f797e88f /juick-server/src/main
parent2e563514d4d3bd5f6ae325376d6c47671e9a474b (diff)
do not show notifications from banned threads
Diffstat (limited to 'juick-server/src/main')
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java1
-rw-r--r--juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java6
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java5
3 files changed, 8 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index 6c13190f..d64ecc04 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -862,6 +862,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"LEFT JOIN users mu ON m.user_id=mu.id " +
"WHERE replies.message_id = :mid " +
"AND NOT EXISTS (SELECT 1 FROM banned WHERE banned.reply_id = replies.reply_id) " +
+ "AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = m.user_id) " +
"ORDER BY replies.reply_id ASC",
new MapSqlParameterSource("mid", mid).addValue("uid", user.getUid()),
new MessageMapper());
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 b97fc0a4..c567b5cd 100644
--- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -106,9 +106,9 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip
msg.getMid(), reply.getUser().getUid());
if (!userids.isEmpty()) {
- return userService.getUsersByID(userids.stream()
- .filter(u -> blacklisted || !userService.isInBLAny(u, reply.getUser().getUid()))
- .collect(Collectors.toList()));
+ return userService.getUsersByID(userids).stream()
+ .filter(u -> blacklisted || !userService.isReplyToBL(u, reply))
+ .collect(Collectors.toList());
}
return Collections.emptyList();
}
diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index bc448151..050fc281 100644
--- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
@@ -461,9 +461,12 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
"INNER JOIN banned ON banned.reply_id = replies.replyto " +
"WHERE replies.message_id = :mid) " +
"SELECT COUNT(reply_id) from replies " +
+ "INNER JOIN messages m ON m.message_id = replies.message_id " +
"WHERE replies.message_id = :mid " +
"AND replies.reply_id = :rid " +
- "AND EXISTS (SELECT 1 FROM banned WHERE banned.reply_id = replies.reply_id) ",
+ "AND (EXISTS (SELECT 1 FROM banned WHERE banned.reply_id = replies.reply_id) " +
+ "OR EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = m.user_id)" +
+ "OR EXISTS (SELECT 1 FROM bl_users b WHERE b.bl_user_id = :uid AND b.user_id = m.user_id))",
new MapSqlParameterSource("uid", user.getUid())
.addValue("mid", reply.getMid())
.addValue("rid", reply.getRid()),