From 8f3a101df251de5965ca28086974c2c10f60c6d9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 27 Feb 2020 10:03:25 +0300 Subject: Include avatars for readers and friends on /me API endpoint --- src/main/java/com/juick/server/api/Users.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/juick/server/api') diff --git a/src/main/java/com/juick/server/api/Users.java b/src/main/java/com/juick/server/api/Users.java index db8267bb..c909fb38 100644 --- a/src/main/java/com/juick/server/api/Users.java +++ b/src/main/java/com/juick/server/api/Users.java @@ -107,8 +107,12 @@ public class Users { List unread = messagesService.getUnread(visitor); me.setUnread(unread); me.setUnreadCount(unread.size()); - me.setRead(userService.getUserFriends(visitor.getUid())); - me.setReaders(userService.getUserReaders(visitor.getUid())); + var friends = userService.getUserFriends(visitor.getUid()); + friends.forEach(r -> r.setAvatar(webApp.getAvatarUrl(r))); + me.setRead(friends); + var readers = userService.getUserReaders(visitor.getUid()); + readers.forEach(r -> r.setAvatar(webApp.getAvatarUrl(r))); + me.setReaders(readers); me.setAvatar(webApp.getAvatarUrl(visitor)); me.getTagStats().addAll(tagService.getUserTagStats(me.getUid())); return (SecureUser)userService.getUserInfo(me); -- cgit v1.2.3