Add accessor that returns the avatar as Image.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 7 Dec 2011 06:22:52 +0000 (07:22 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 7 Dec 2011 06:22:52 +0000 (07:22 +0100)
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java

index ead6066..bc72776 100644 (file)
@@ -112,6 +112,12 @@ public class SoneAccessor extends ReflectionAccessor {
                                return new Trust(null, null, null);
                        }
                        return trust;
+               } else if (member.equals("avatar")) {
+                       String avatarId = sone.getAvatar();
+                       if (avatarId == null) {
+                               return null;
+                       }
+                       return core.getImage(avatarId);
                }
                return super.get(templateContext, object, member);
        }