diff options
Diffstat (limited to 'src/main/java/com/juick/www/rss/MessagesView.java')
-rw-r--r-- | src/main/java/com/juick/www/rss/MessagesView.java | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/src/main/java/com/juick/www/rss/MessagesView.java b/src/main/java/com/juick/www/rss/MessagesView.java index 71d63754..d6edeb28 100644 --- a/src/main/java/com/juick/www/rss/MessagesView.java +++ b/src/main/java/com/juick/www/rss/MessagesView.java @@ -93,37 +93,39 @@ public class MessagesView extends AbstractRssFeedView { String feedType = (String) model.get("feedType"); if (userObj != null) { User user = (User) userObj; - feed.setDescription(String.format("The latest messages by @%s at Juick", user.getName())); - String title = String.format("%s - Juick", user.getName()); - feed.setTitle(title); - String link = String.format("https://juick.com/%s/", user.getName()); - feed.setLink(link); - try { - Attachment avatar = storageService.getAvatarMetadata(user); - Image rssImage = new Image(); - rssImage.setUrl(webApp.getAvatarUrl(user)); - rssImage.setTitle(title); - rssImage.setLink(link); - rssImage.setHeight(avatar.getHeight()); - rssImage.setWidth(avatar.getWidth()); - feed.setImage(rssImage); - } catch (IOException e) { - logger.warn("Feed avatar not found for {}", user.getName()); + if (!user.isAnonymous()) { + feed.setDescription(String.format("The latest messages by @%s at Juick", user.getName())); + String title = String.format("%s - Juick", user.getName()); + feed.setTitle(title); + String link = String.format("https://juick.com/%s/", user.getName()); + feed.setLink(link); + try { + Attachment avatar = storageService.getAvatarMetadata(user); + Image rssImage = new Image(); + rssImage.setUrl(webApp.getAvatarUrl(user)); + rssImage.setTitle(title); + rssImage.setLink(link); + rssImage.setHeight(avatar.getHeight()); + rssImage.setWidth(avatar.getWidth()); + feed.setImage(rssImage); + } catch (IOException e) { + logger.warn("Feed avatar not found for {}", user.getName()); + } + + String href = String.format("https://rss.juick.com/%s/%s", user.getName(), feedType); + AtomLinkModule atomLinkModule = new AtomLinkModuleImpl(); + Link atomLink = new Link(); + atomLink.setHref(href); + atomLink.setType("application/rss+xml"); + atomLink.setRel("self"); + atomLinkModule.setLinks(Collections.singletonList(atomLink)); + + feed.getModules().add(atomLinkModule); + } else { + feed.setDescription("The latest messages at Juick"); + feed.setLink("https://juick.com/"); + feed.setTitle("Juick"); } - - String href = String.format("https://rss.juick.com/%s/%s", user.getName(), feedType); - AtomLinkModule atomLinkModule = new AtomLinkModuleImpl(); - Link atomLink = new Link(); - atomLink.setHref(href); - atomLink.setType("application/rss+xml"); - atomLink.setRel("self"); - atomLinkModule.setLinks(Collections.singletonList(atomLink)); - - feed.getModules().add(atomLinkModule); - } else { - feed.setDescription("The latest messages at Juick"); - feed.setLink("https://juick.com/"); - feed.setTitle("Juick"); } MediaModule mediaModule = new MediaModuleImpl(); |