aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java')
-rw-r--r--juick-server/src/main/java/com/juick/server/MessengerManager.java3
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java3
2 files changed, 4 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/MessengerManager.java b/juick-server/src/main/java/com/juick/server/MessengerManager.java
index 303e08ce..8bfcafd0 100644
--- a/juick-server/src/main/java/com/juick/server/MessengerManager.java
+++ b/juick-server/src/main/java/com/juick/server/MessengerManager.java
@@ -15,6 +15,7 @@ import com.github.messenger4j.webhook.event.TextMessageEvent;
import com.juick.Message;
import com.juick.User;
import com.juick.server.component.MessageEvent;
+import com.juick.server.helpers.AnonymousUser;
import com.juick.service.MessagesService;
import com.juick.service.MessengerService;
import com.juick.service.SubscriptionService;
@@ -76,7 +77,7 @@ public class MessengerManager implements ApplicationListener<MessageEvent> {
final String senderId = event.senderId();
final Instant timestamp = event.timestamp();
- User user_from = userService.getUserByUID(messengerService.getUserId(senderId)).orElse(new User());
+ User user_from = userService.getUserByUID(messengerService.getUserId(senderId)).orElse(AnonymousUser.INSTANCE);
logger.info("Found juick user {}", user_from.getUid());
if (user_from.isAnonymous()) {
try {
diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
index c9097cb2..6e6198a8 100644
--- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
@@ -19,6 +19,7 @@ package com.juick.server;
import com.juick.User;
import com.juick.server.component.*;
+import com.juick.server.helpers.AnonymousUser;
import com.juick.server.helpers.CommandResult;
import com.juick.server.util.HttpUtils;
import com.juick.service.MessagesService;
@@ -113,7 +114,7 @@ public class TelegramBotManager implements NotificationListener {
return;
}
}
- User user_from = userService.getUserByUID(telegramService.getUser(message.chat().id())).orElse(new User());
+ User user_from = userService.getUserByUID(telegramService.getUser(message.chat().id())).orElse(AnonymousUser.INSTANCE);
logger.info("Found juick user {}", user_from.getUid());
List<Long> chats = telegramService.getChats();