From e8041f3f4158a0cffd7403fec22272967475ddb7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Apr 2018 18:25:16 +0300 Subject: jdbc: do not show messages with banned tags in feeds --- .../java/com/juick/server/tests/ServerTests.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'juick-server') 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 e8111239..087acbc4 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 @@ -879,4 +879,25 @@ public class ServerTests { .andExpect(status().isOk()); assertThat(lastRead.apply(ugnich, mid), is(newfreefdrid)); } + @Test + public void feedsShouldNotContainMessagesWithBannedTags() { + Tag banned = tagService.getTag("banned", true); + int mid = messagesService.createMessage(ugnich.getUid(), "yo", "jpg", + Collections.singletonList(banned)); + privacyQueriesService.blacklistTag(freefd, banned); + assertTrue(messagesService.getMessages(messagesService.getAll(freefd.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertFalse(messagesService.getMessages(messagesService.getAll(ugnich.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertTrue(messagesService.getMessages(messagesService.getPhotos(freefd.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertFalse(messagesService.getMessages(messagesService.getPhotos(ugnich.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + jdbcTemplate.update("UPDATE messages SET popular=1 WHERE message_id=?", mid); + assertTrue(messagesService.getMessages(messagesService.getPopular(freefd.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertFalse(messagesService.getMessages(messagesService.getPopular(ugnich.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + + } } -- cgit v1.2.3