From 6fbe53de47e0301e563a83f775ca6a78eed78fc4 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 5 Feb 2020 10:19:26 +0300 Subject: Do not count unread messages in threads from blacklisted users --- src/main/java/com/juick/service/MessagesServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/juick') diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index c405fde4..8f1387cf 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -1156,9 +1156,11 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return jdbcTemplate.queryForList( "select subscr_messages.message_id " + "from subscr_messages inner join messages on subscr_messages.message_id=messages.message_id " + - "where subscr_messages.suser_id=? and " + + "where subscr_messages.suser_id=? " + + "AND NOT EXISTS (SELECT 1 FROM bl_users WHERE " + + "user_id = ? AND bl_user_id = messages.user_id) AND " + "messages.replies>subscr_messages.last_read_rid", - Integer.class, user.getUid()); + Integer.class, user.getUid(), user.getUid()); } @Transactional -- cgit v1.2.3