diff options
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/Service.java | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Service.java b/juick-api/src/main/java/com/juick/api/controllers/Service.java index b3516391..9e7f3333 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Service.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Service.java @@ -17,7 +17,6 @@ package com.juick.api.controllers; -import com.juick.ExternalToken; import com.juick.Message; import com.juick.User; import com.juick.server.util.HttpBadRequestException; @@ -28,7 +27,10 @@ import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; import com.juick.service.UserService; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; import javax.inject.Inject; @@ -69,15 +71,4 @@ public class Service { } throw new HttpBadRequestException(); } - @GetMapping("/tokens") - public User getTokensForUser(@RequestParam(defaultValue = "0") int uid) { - User visitor = UserUtils.getCurrentUser(); - if ((visitor.getUid() == 0) && !(visitor.getName().equals("juick"))) { - throw new HttpForbiddenException(); - } - User user = userService.getUserByUID(uid).orElseThrow(IllegalStateException::new); - crosspostService.getTwitterToken(uid).ifPresent( - t -> user.getTokens().add(t)); - return user; - } } |