aboutsummaryrefslogtreecommitdiff
path: root/juick-common
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-25 12:12:12 +0300
committerGravatar Vitaly Takmazov2018-06-25 12:12:12 +0300
commit9efeead3bae831abd66420771ebf2ad703df0026 (patch)
tree22736f2d4e40ef515d9bb895bf22a31e9979425b /juick-common
parentae542818abf233ec926d32363bd729d249745f66 (diff)
CommandsManager: handle subscription requests to unknown user
Diffstat (limited to 'juick-common')
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java3
1 files changed, 3 insertions, 0 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 9ff0fdbb..b9f27940 100644
--- a/juick-common/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java
@@ -308,6 +308,9 @@ public class CommandsManager {
public CommandResult commandSubscribeUser(User user, URI attachment, String... args) {
boolean subscribe = args[0].equalsIgnoreCase("s");
User toUser = userService.getUserByName(args[1]);
+ if (toUser.isAnonymous()) {
+ return CommandResult.fromString("User not found");
+ }
if (subscribe) {
if (subscriptionService.subscribeUser(user, toUser)) {
// TODO: already subscribed case