aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-10 11:39:33 +0300
committerGravatar Vitaly Takmazov2018-09-10 11:39:33 +0300
commitb300e063d389c8ea205c23af7011b0dfd6f6ba7f (patch)
treedfe5f120cd8f35cedb59c1a3319be2c067f21620 /juick-server/src
parent2673dabfba6e1322bbe5cf3f53f962643b516b90 (diff)
Discuss feed for anonymous
Diffstat (limited to 'juick-server/src')
-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 " +