diff options
author | 2017-12-27 16:23:28 +0300 | |
---|---|---|
committer | 2018-01-12 09:12:09 +0300 | |
commit | bf5f2142d73a5745124d03f6b6f06c59873e47de (patch) | |
tree | 969d43a3bf6d39197313e16080b8b8472975cbe2 /juick-www/src/main/java | |
parent | 0c78bc5c08632718eb94c0021cf3ee47fb8ddb82 (diff) |
Messenger bot
Diffstat (limited to 'juick-www/src/main/java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/NewMessage.java | 2 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/SignUp.java | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index d188dfbe..9e022557 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -190,7 +190,7 @@ public class NewMessage { sharetwi += " http://juick.com/" + mid; model.addAttribute("sharetwi", sharetwi); } - if (!crosspostService.getFacebookToken(visitor.getUid()).isPresent()) { + if (!crosspostService.getFacebookTokens(visitor.getUid()).isPresent()) { model.addAttribute("facebook", 1); } model.addAttribute("tags", tagService.getUserTagStats(visitor.getUid()).stream() diff --git a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java index c8c64ef5..a5851215 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java +++ b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java @@ -20,6 +20,7 @@ import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.UserUtils; import com.juick.service.CrosspostService; +import com.juick.service.MessengerService; import com.juick.service.UserService; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -42,6 +43,8 @@ public class SignUp { private UserService userService; @Inject private CrosspostService crosspostService; + @Inject + private MessengerService messengerService; @GetMapping("/signup") @@ -67,6 +70,9 @@ public class SignUp { case "durov": account = crosspostService.getTelegramNameByHash(hash); break; + case "messenger": + account = messengerService.getDisplayName(hash); + break; } if (account == null) { throw new HttpBadRequestException(); @@ -113,7 +119,8 @@ public class SignUp { if (!(type.charAt(0) == 'f' && crosspostService.setFacebookUser(hash, uid)) && !(type.charAt(0) == 'v' && crosspostService.setVKUser(hash, uid)) && !(type.charAt(0) == 'd' && crosspostService.setTelegramUser(hash, uid)) - && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid))) { + && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid)) + && !(type.charAt(0) == 'm' && messengerService.linkMessengerUser(hash, uid))) { throw new HttpBadRequestException(); } @@ -132,7 +139,8 @@ public class SignUp { if (!(type.charAt(0) == 'f' && crosspostService.setFacebookUser(hash, uid)) && !(type.charAt(0) == 'v' && crosspostService.setVKUser(hash, uid)) && !(type.charAt(0) == 'd' && crosspostService.setTelegramUser(hash, uid)) - && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid))) { + && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid)) + && !(type.charAt(0) == 'm' && messengerService.linkMessengerUser(hash, uid))) { throw new HttpBadRequestException(); } } |