aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java2
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java1
2 files changed, 2 insertions, 1 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
index d339d229..609b7e01 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -784,7 +784,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "ON messages.message_id=messages_txt.message_id) "
+ "INNER JOIN users ON messages.user_id=users.id "
+ "LEFT JOIN favorites "
- + "ON messages.message_id = favorites.message_id "
+ + "ON messages.message_id = favorites.message_id AND favorites.like_id=1 "
+ "WHERE messages.message_id IN (:ids) GROUP BY messages.message_id",
new MapSqlParameterSource("ids", mids),
new MessageMapper());
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 0902eb8f..e23116ad 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
@@ -820,6 +820,7 @@ public class ServerTests {
Message msg4 = messagesService.getMessage(mid1);
assertThat(msg4.getLikes(), is(0));
+ assertThat(messagesService.getMessages(Collections.singletonList(mid1)).get(0).getLikes(), is(0));
Assert.assertEquals(1, msg4.getReactions().stream().filter(r -> r.getId() == 2)
.findFirst().orElseThrow(IllegalStateException::new).getCount());
}