aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-11-12 02:46:28 +0300
committerGravatar Vitaly Takmazov2020-11-12 03:02:12 +0300
commit4a2b56a850f5bd4802c1001f0249f5ab34c6bb1e (patch)
treee4283c1e1268d8205c5bd3a1f4f85b7210a9b822 /src/test
parent335900ddadd8b4943d87b7d0bf77b2e32025c703 (diff)
Do not receive mentions from blacklisted users in original posts
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java14
1 files changed, 14 insertions, 0 deletions
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 {