diff options
author | Vitaly Takmazov | 2023-04-26 08:35:39 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-04-26 08:35:39 +0300 |
commit | abecbe6d9c9016bd40cb97d7c4206e1a4cc15c41 (patch) | |
tree | d08ec07b4b3fdd4010a9ea30f54e3c3f0598164e /src/main/java/com/juick | |
parent | b983779c1e8384403d2e67f386985d8b18393769 (diff) |
API: include hidden messages
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/www/api/Messages.java | 20 |
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(); |