From 4a2b56a850f5bd4802c1001f0249f5ab34c6bb1e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 12 Nov 2020 02:46:28 +0300 Subject: Do not receive mentions from blacklisted users in original posts --- src/test/java/com/juick/server/tests/ServerTests.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/test/java/com/juick/server') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 925d42f6..aea9447f 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -352,6 +352,7 @@ public class ServerTests { subscriptionService.unSubscribeUser(freefd, ugnich); assertThat(subscriptionService.getSubscribedUsers(ugnich.getUid(), msg).size(), equalTo(0)); Message mentionMessage = new Message(); + mentionMessage.setUser(ugnich); mentionMessage.setText("@freefd - dick"); assertThat(subscriptionService.getSubscribedUsers(ugnich.getUid(), mentionMessage).size(), equalTo(1)); subscriptionService.subscribeUser(freefd, ugnich); @@ -1408,6 +1409,19 @@ public class ServerTests { privacyQueriesService.blacklistUser(mentioner, commenter); assertThat(subscriptionService.getUsersSubscribedToComments(msg, reply).size(), is(0)); } + @Test + public void mentionsInPosts() { + jdbcTemplate.execute("DELETE FROM bl_users"); + int mid = messagesService.createMessage(ugnich.getUid(), "@freefd is dick", null, null); + Message msg = messagesService.getMessage(mid).get(); + assertThat(subscriptionService.getSubscribedUsers(ugnich.getUid(), msg).get(0), is(freefd)); + privacyQueriesService.blacklistUser(freefd, ugnich); + assertThat(subscriptionService.getSubscribedUsers(ugnich.getUid(), msg).size(), is(0)); + int mid2 = messagesService.createMessage(freefd.getUid(), "@ugnich is dick", null, null); + Message msg2 = messagesService.getMessage(mid2).get(); + assertThat(subscriptionService.getSubscribedUsers(freefd.getUid(), msg2).get(0), is(ugnich)); + jdbcTemplate.execute("DELETE FROM bl_users"); + } @Test public void credentialsShouldNeverBeSerialized() throws Exception { -- cgit v1.2.3