diff options
Diffstat (limited to 'juick-server/src')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/TagServiceImpl.java | 2 | ||||
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/service/TagServiceImpl.java b/juick-server/src/main/java/com/juick/service/TagServiceImpl.java index 524ad32d..3ee21aec 100644 --- a/juick-server/src/main/java/com/juick/service/TagServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/TagServiceImpl.java @@ -214,7 +214,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService { return StreamUtils.takeWhile(Arrays.stream(firstLine.split("\\ ")), t -> !t.equals("*") && t.startsWith("*")) .map(t -> getTag(t.substring(1), true)) - .collect(Collectors.toList()); + .distinct().collect(Collectors.toList()); } @Transactional(readOnly = true) 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 75024029..c4915acf 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 @@ -1690,4 +1690,10 @@ public class ServerTests { writer.write(result.getResponse().getContentAsString()); writer.flush(); } + @Test + public void newMessageShouldNotContainDuplicatedTags() throws Exception { + CommandResult result = commandsManager.processCommand(ugnich, "*test *test test", emptyUri); + assertThat(result.getNewMessage().isPresent(), is(true)); + assertThat(result.getNewMessage().get().getTags().size(), is (1)); + } } |