From 6fbe53de47e0301e563a83f775ca6a78eed78fc4 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 5 Feb 2020 10:19:26 +0300 Subject: Do not count unread messages in threads from blacklisted users --- src/test/java/com/juick/server/tests/ServerTests.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/test/java/com/juick') 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 -- cgit v1.2.3