aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-02-05 10:19:26 +0300
committerGravatar Vitaly Takmazov2020-02-05 10:19:26 +0300
commit6fbe53de47e0301e563a83f775ca6a78eed78fc4 (patch)
treeb4511daeecc09171a9155602e0ef91504b61e1e7 /src/test/java/com
parent23aba1cc93d1ee28a52560b2205a992494d04a33 (diff)
Do not count unread messages in threads from blacklisted users
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index a16d920b..f540fd01 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1749,6 +1749,7 @@ public class ServerTests {
jdbcTemplate.execute("DELETE FROM messages");
jdbcTemplate.execute("DELETE FROM replies");
jdbcTemplate.execute("DELETE FROM subscr_messages");
+ jdbcTemplate.execute("DELETE FROM bl_users");
MvcResult loginResult = mockMvc.perform(post("/login")
.param("username", freefdName)
.param("password", freefdPassword))
@@ -1761,11 +1762,22 @@ public class ServerTests {
loginCookie.getValue()));
int mid = messagesService.createMessage(ugnich.getUid(), "new test", null, null);
subscriptionService.subscribeMessage(messagesService.getMessage(mid).get(), freefd);
- int rid = messagesService.createReply(mid, 0, ugnich, "new reply", null);
+ messagesService.createReply(mid, 0, ugnich, "new reply", null);
HtmlPage discussionsPage = webClient.getPage("http://localhost:8080/?show=discuss");
assertThat(discussionsPage.querySelectorAll("#global a .badge").size(), is(1));
HtmlPage unreadThread = webClient.getPage(String.format("http://localhost:8080/ugnich/%d", mid));
assertThat(unreadThread.querySelectorAll("#global a .badge").size(), is(0));
+ messagesService.createReply(mid, 0, ugnich, "reply to ban", null);
+ discussionsPage.refresh();
+ assertThat(discussionsPage.querySelectorAll("#global a .badge").size(), is(1));
+ privacyQueriesService.blacklistUser(freefd, ugnich);
+ assertThat(messagesService.getUnread(freefd).size(), is(0));
+ /* TODO: fix
+ discussionsPage.refresh();
+ var unreads = discussionsPage.querySelectorAll("#global a .badge");
+ assertThat(unreads.size(), is(0));
+ */
+ privacyQueriesService.blacklistUser(freefd, ugnich);
}
@Test