aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/controllers
diff options
context:
space:
mode:
authorGravatar Evgeniy Shishkin2017-03-07 17:12:02 +0300
committerGravatar Evgeniy Shishkin2017-03-07 17:45:48 +0300
commit4b2821008dedf2300d44548f34a53735afc07000 (patch)
tree81d1671015c5df41fe44770ea7c22a1cdef7c833 /juick-api/src/main/java/com/juick/api/controllers
parent1a31521dd4e1f7ef96c9d82d69b3d7aa42282eeb (diff)
get user blog with recommendations
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/controllers')
-rw-r--r--juick-api/src/main/java/com/juick/api/controllers/Messages.java23
1 files changed, 3 insertions, 20 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
index 584ff3cf..7348c54a 100644
--- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java
+++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
@@ -69,6 +69,7 @@ public class Messages {
public ResponseEntity<List<com.juick.Message>> getMessages(
@RequestParam(required = false) String uname,
@RequestParam(defaultValue = "0") int before_mid,
+ @RequestParam(required = false) String withrecommended,
@RequestParam(required = false) String popular,
@RequestParam(required = false) String media,
@RequestParam(required = false) String tag) {
@@ -88,6 +89,8 @@ public class Messages {
} else {
return NOT_FOUND;
}
+ } else if (!StringUtils.isEmpty(withrecommended)) {
+ mids = messagesService.getUserBlogWithRecommendations(user.getUid(), 0, before_mid);
} else {
mids = messagesService.getUserBlog(user.getUid(), 0, before_mid);
}
@@ -131,26 +134,6 @@ public class Messages {
return NOT_FOUND;
}
- @RequestMapping("/messages/recommended")
- public ResponseEntity<List<com.juick.Message>> doGetRecommended(
- @RequestParam(defaultValue = "0") int before_mid) {
- User visitor = UserUtils.getCurrentUser();
- int vuid = visitor.getUid();
- if (vuid == 0) {
- return FORBIDDEN;
- }
- List<Integer> mids = messagesService.getUserRecommendations(vuid, before_mid);
- if (mids != null && !mids.isEmpty()) {
- List<com.juick.Message> msgs = messagesService.getMessages(mids);
- if (msgs != null && !msgs.isEmpty()) {
- return ResponseEntity.ok(msgs);
- } else {
- return FORBIDDEN;
- }
- }
- return NOT_FOUND;
- }
-
@RequestMapping("/messages/set_privacy")
@ResponseBody
public ResponseEntity<Status> doSetPrivacy(