aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java2
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java2
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java3
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java2
4 files changed, 6 insertions, 3 deletions
diff --git a/juick-common/src/main/java/com/juick/server/CommandsManager.java b/juick-common/src/main/java/com/juick/server/CommandsManager.java
index 51051b7b..1907bde7 100644
--- a/juick-common/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java
@@ -251,7 +251,7 @@ public class CommandsManager {
.map(t -> String.format("\n*%s - %d", t.getTag().getName(), t.getUsageCount())).collect(Collectors.joining());
return CommandResult.fromString(msg);
}
- @UserCommand(pattern = "S", help = "S - Show your subscriptions")
+ @UserCommand(pattern = "S", help = "S - Show your subscriptions", patternFlags = Pattern.CASE_INSENSITIVE)
public CommandResult commandSubscriptions(User currentUser, URI attachment, String... args) {
List<User> friends = userService.getUserFriends(currentUser.getUid());
List<String> tags = subscriptionService.getSubscribedTags(currentUser);
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 b64d7fd9..b6a37883 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 DISTINCT users.nick FROM replies " +
+ List<String> users = getJdbcTemplate().queryForList("SELECT 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(","));
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index 7626651a..b97fc0a4 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -203,7 +203,8 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip
@Transactional(readOnly = true)
@Override
public List<String> getSubscribedTags(User user) {
- return getJdbcTemplate().queryForList("SELECT tags.name FROM subscr_tags INNER JOIN tags USING(tag_id) " +
+ return getJdbcTemplate().queryForList("SELECT tags.name FROM subscr_tags INNER JOIN tags " +
+ "ON(tags.tag_id = subscr_tags.tag_id) " +
"WHERE subscr_tags.suser_id=? ORDER BY tags.name", String.class, user.getUid());
}
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 692cc182..4a495a6e 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
@@ -688,6 +688,8 @@ public class ServerTests {
commandsManager.processCommand(user, String.format("#%d", mid), emptyUri).getText().startsWith("@me"));
int readerUid = userService.createUser("dummyReader", "dummySecret");
User readerUser = userService.getUserByUID(readerUid).orElse(new User());
+ assertThat(commandsManager.processCommand(readerUser, "s", emptyUri).getText().startsWith("You are subscribed to"), is(true));
+ assertThat(commandsManager.processCommand(readerUser, "S", emptyUri).getText().startsWith("You are subscribed to"), is(true));
assertEquals("should be subscribed", "Subscribed",
commandsManager.processCommand(readerUser, "S #" + mid, emptyUri).getText());
assertEquals("should be favorited", "Message is added to your recommendations",