aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/Messages.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/api/Messages.java')
-rw-r--r--src/main/java/com/juick/www/api/Messages.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java
index d127d166..c9936dee 100644
--- a/src/main/java/com/juick/www/api/Messages.java
+++ b/src/main/java/com/juick/www/api/Messages.java
@@ -91,25 +91,33 @@ public class Messages {
List<Integer> mids;
if (StringUtils.hasText(uname)) {
User user = userService.getUserByName(uname);
+ int privacy = 0;
+ if (!visitor.isAnonymous()) {
+ if (user.getUid() == visitor.getUid() || visitor.getUid() == 1) {
+ privacy = -3;
+ } else if (userService.isInWL(user.getUid(), visitor.getUid())) {
+ privacy = -2;
+ }
+ }
if (!user.isAnonymous() && !user.isBanned()) {
if (StringUtils.hasText(media)) {
- mids = messagesService.getUserPhotos(user.getUid(), 0, before);
+ mids = messagesService.getUserPhotos(user.getUid(), privacy, before);
} else if (StringUtils.hasText(tag)) {
Tag tagObject = tagService.getTag(tag, false);
if (tagObject != null) {
- mids = messagesService.getUserTag(user.getUid(), tagObject.getId(), 0, before);
+ mids = messagesService.getUserTag(user.getUid(), tagObject.getId(), privacy, before);
} else {
throw new HttpNotFoundException();
}
} else if (StringUtils.hasText(withrecommended)) {
- mids = messagesService.getUserBlogWithRecommendations(user, visitor, 0, before);
+ mids = messagesService.getUserBlogWithRecommendations(user, visitor, privacy, before);
} else if (daysback > 0) {
- mids = messagesService.getUserBlogAtDay(user.getUid(), 0, daysback);
+ mids = messagesService.getUserBlogAtDay(user.getUid(), privacy, daysback);
} else if (StringUtils.hasText(search)) {
- mids = messagesService.getUserSearch(visitor, user.getUid(), search, 0,
+ mids = messagesService.getUserSearch(visitor, user.getUid(), search, privacy,
page);
} else {
- mids = messagesService.getUserBlog(user.getUid(), 0, before);
+ mids = messagesService.getUserBlog(user.getUid(), privacy, before);
}
} else {
throw new HttpNotFoundException();