aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java5
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java1
2 files changed, 5 insertions, 1 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
index 90b70612..403dac09 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
@@ -214,8 +214,11 @@ public class TagServiceImpl extends BaseJdbcService implements TagService {
newTags.stream().filter(t -> !currentTags.contains(t))
.forEach(t -> getJdbcTemplate().update("INSERT INTO messages_tags(message_id,tag_id) VALUES (?,?)", mid, t.TID));
- return getMessageTags(mid).stream()
+ List<Tag> result = getMessageTags(mid).stream()
.map(TagStats::getTag).collect(Collectors.toList());
+ jdbcTemplate.update("UPDATE messages_txt SET tags=? WHERE message_id=?", result.stream()
+ .map(Tag::getName).collect(Collectors.joining(" ")), mid);
+ return result;
}
@Override
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 cdf10326..1acc0c15 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
@@ -651,6 +651,7 @@ public class ServerTests {
commandsManager.processCommand(user, "#" + mid + " *there", emptyUri).getText());
assertEquals("number of tags should match", 2,
tagService.getMessageTags(mid).size());
+ assertThat(messagesService.getMessage(mid).getTags().size(), is(2));
assertEquals("should be blacklisted", "Tag added to your blacklist",
commandsManager.processCommand(readerUser, "BL *there", emptyUri).getText());
assertEquals("number of subscribed users should match", 0,