diff options
author | Vitaly Takmazov | 2023-04-26 08:53:58 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-04-26 08:53:58 +0300 |
commit | bd521d4b86f9b3b16caaba714d04e05c2f288847 (patch) | |
tree | 397fb3a1009bddf40568a49e187e3571fdd9db2a | |
parent | e0c9e617dc84296593f732f2c414d1ebe7d7d640 (diff) |
Do not show hidden messages in discussions
-rw-r--r-- | src/main/java/com/juick/service/MessagesServiceImpl.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index 85dadd77..9da5c16c 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -616,7 +616,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().query( "SELECT message_id FROM messages WHERE " + (to != 0 ? " updated < :to AND" : StringUtils.EMPTY) + " NOT EXISTS (SELECT 1 from users u WHERE u.banned = 1" - + " AND u.id = messages.user_id and u.id <> :uid) " + + " AND u.id = messages.user_id and u.id <> :uid)" + + " AND privacy >= 0" + " ORDER BY updated DESC, message_id DESC " + limit(20), sqlParameterSource, (rs, rowNum) -> rs.getInt(1)); } @@ -624,6 +625,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "SELECT messages.message_id, messages.updated FROM subscr_messages " + "INNER JOIN messages ON messages.message_id=subscr_messages.message_id " + "WHERE suser_id = :uid " + (to != 0 ? "AND updated < :to " : StringUtils.EMPTY) + + "AND (messages.privacy >= 0 OR (messages.privacy >= -2 AND messages.privacy <= -1 " + + "AND EXISTS (SELECT 1 FROM wl_users w " + + "WHERE w.wl_user_id = :uid and w.user_id = messages.user_id)))" + " AND NOT EXISTS (SELECT 1 from users u WHERE u.banned = 1" + " AND u.id = messages.user_id and u.id <> :uid) " + "ORDER BY updated DESC, messages.message_id DESC " + limit(20), |