aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-jdbc/src/main')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java10
1 files changed, 5 insertions, 5 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 8554b35f..b64d7fd9 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
@@ -217,7 +217,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional
void updateRepliesBy(int mid) {
- List<String> users = getJdbcTemplate().queryForList("SELECT users.nick FROM replies " +
+ List<String> users = getJdbcTemplate().queryForList("SELECT DISTINCT users.nick FROM replies " +
"INNER JOIN users ON replies.user_id=users.id WHERE replies.message_id=? " +
"GROUP BY replies.user_id ORDER BY COUNT(replies.reply_id) DESC LIMIT 5", String.class, mid);
String result = users.stream().map(u -> "@" + u).collect(Collectors.joining(","));
@@ -243,7 +243,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Override
public List<Reaction> listReactions() {
- return jdbcTemplate.query("SELECT like_id, description FROM reactions", (RowMapper<Reaction>) (rs, rowNum) -> {
+ return jdbcTemplate.query("SELECT like_id, description FROM reactions", (rs, rowNum) -> {
Reaction reaction = new Reaction(rs.getInt("like_id"));
reaction.setDescription(rs.getString("description"));
return reaction;
@@ -330,7 +330,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "messages.ts,"
+ "messages.readonly, messages.privacy, messages.replies,"
+ "messages.attach, messages.place_id, messages.lat,"
- + "messages.lon, COUNT(favorites.user_id) as likes, messages.hidden,"
+ + "messages.lon, COUNT(DISTINCT favorites.user_id) as likes, messages.hidden,"
+ "txt.tags, txt.repliesby, txt.txt, '' as q, messages.updated, 0 as to_uid, "
+ "NULL as to_name FROM messages "
+ "INNER JOIN users ON messages.user_id = users.id "
@@ -421,7 +421,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Override
public List<String> getMessageRecommendations(final int mid) {
return getJdbcTemplate().queryForList(
- "SELECT users.nick FROM favorites INNER JOIN users " +
+ "SELECT DISTINCT users.nick FROM favorites INNER JOIN users " +
"ON (favorites.message_id = ? AND favorites.user_id = users.id) WHERE favorites.like_id=1",
new Object[]{mid},
String.class);
@@ -783,7 +783,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "messages.ts,"
+ "messages.readonly,messages.privacy,messages.replies,"
+ "messages.attach,messages.place_id,messages.lat,"
- + "messages.lon,COUNT(favorites.user_id) AS likes,messages.hidden,"
+ + "messages.lon,COUNT(DISTINCT favorites.user_id) AS likes,messages.hidden,"
+ "messages_txt.tags,messages_txt.repliesby, messages_txt.txt, '' as q, "
+ "messages.updated, 0 as to_uid, NULL as to_name "
+ "FROM (messages INNER JOIN messages_txt "