From 66d7b4a08dfd8b5207ff35ba99690d71e99794e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 7 Dec 2011 07:22:52 +0100 Subject: [PATCH] Add accessor that returns the avatar as Image. --- src/main/java/net/pterodactylus/sone/template/SoneAccessor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java index ead6066..bc72776 100644 --- a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java @@ -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); } -- 2.7.4