aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java8
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java6
2 files changed, 11 insertions, 3 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 b0daa9fb..5dba41be 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -465,12 +465,14 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
.addValue("visitorUid", visitorUid);
return getNamedParameterJdbcTemplate().queryForList(
- "SELECT message_id FROM (tags INNER JOIN messages_tags " +
+ "SELECT messages.message_id FROM (tags INNER JOIN messages_tags " +
"ON ((tags.synonym_id = :tid OR tags.tag_id = :tid) AND tags.tag_id = messages_tags.tag_id)) " +
- "INNER JOIN messages USING(message_id) WHERE " +
+ "INNER JOIN messages ON messages.message_id = messages_tags.message_id WHERE " +
(before > 0 ?
" messages.message_id < :before AND " : StringUtils.EMPTY) +
- "(messages.privacy > 0 OR messages.user_id = :visitorUid) ORDER BY message_id DESC LIMIT :cnt",
+ "(messages.privacy > 0 OR messages.user_id = :visitorUid) " +
+ "AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :visitorUid and b.bl_user_id = messages.user_id) " +
+ "ORDER BY messages.message_id DESC LIMIT :cnt",
sqlParameterSource,
Integer.class);
}
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index 13cb8d41..a9e68b68 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1121,6 +1121,12 @@ public class ServerTests {
assertThat(messagesService.getReplies(ugnich, mid).size(), is(5));
List<Message> nonblmsgs = messagesService.getMessages(ugnich, Collections.singletonList(mid));
assertThat(nonblmsgs.get(0).getReplies(), is(5));
+ commandsManager.processCommand(ugnich, "BL @freefd", emptyUri);
+ Tag tag = tagService.getTag("linux", true);
+ messagesService.createMessage(freefd.getUid(), "sux", null, Collections.singletonList(tag));
+ assertThat(messagesService.getTag(tag.TID, freefd.getUid(), 0, 10).size(), is(1));
+ assertThat(messagesService.getTag(tag.TID, ugnich.getUid(), 0, 10).size(), is(0));
+ commandsManager.processCommand(ugnich, "BL @freefd", emptyUri);
}
@Test
public void cmykJpegShouldBeProcessedCorrectly() throws Exception {