aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java2
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java8
2 files changed, 9 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
index de50849d..06721912 100644
--- a/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
+++ b/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
@@ -128,7 +128,7 @@ public class MessagesWWW {
} else if (paramShow.equals("private") && !visitor.isAnonymous()) {
title = "Приватные";
mids = messagesService.getPrivate(visitor.getUid(), paramBefore);
- } else if (paramShow.equals("discuss") && !visitor.isAnonymous()) {
+ } else if (paramShow.equals("discuss")) {
title = "Обсуждения";
mids = messagesService.getDiscussions(visitor.getUid(), paramTo);
} else if (paramShow.equals("recommended") && !visitor.isAnonymous()) {
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index a90cba55..b0daa9fb 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -572,6 +572,14 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
.addValue("uid", uid)
.addValue("to", new Timestamp(to));
+ if (uid == 0) {
+ return getNamedParameterJdbcTemplate().query("SELECT message_id FROM messages" +
+ (to != 0 ?
+ " WHERE updated < :to " : StringUtils.EMPTY) +
+ " ORDER BY updated DESC, message_id DESC LIMIT 20",
+ sqlParameterSource,
+ (rs, rowNum) -> rs.getInt(1));
+ }
return getNamedParameterJdbcTemplate().query(
"SELECT messages.message_id, messages.updated FROM subscr_messages " +
"INNER JOIN messages ON messages.message_id=subscr_messages.message_id " +