aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/juick/server/www/controllers/SocialLogin.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/juick/server/www/controllers/SocialLogin.java b/src/main/java/com/juick/server/www/controllers/SocialLogin.java
index 8081c54b..e845247e 100644
--- a/src/main/java/com/juick/server/www/controllers/SocialLogin.java
+++ b/src/main/java/com/juick/server/www/controllers/SocialLogin.java
@@ -53,6 +53,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
@@ -303,7 +304,11 @@ public class SocialLogin {
return "redirect:/" + Utils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY);
} else {
String username = StringUtils.defaultString(params.get("username"), params.get("first_name"));
- telegramService.createTelegramUser(tgUser, username);
+ List<Long> chats = telegramService.getAnonymous();
+ if (!chats.contains(tgUser)) {
+ logger.info("added chat with {}", username);
+ telegramService.createTelegramUser(tgUser, username);
+ }
return "redirect:/signup?type=durov&hash=" + userService.getSignUpHashByTelegramID(tgUser, username);
}
} else {