Allow the ID of an image as input for the image link filter.
[Sone.git] / src / main / java / net / pterodactylus / sone / template / SoneAccessor.java
index 76fdcc1..bc72776 100644 (file)
@@ -100,7 +100,7 @@ public class SoneAccessor extends ReflectionAccessor {
                } else if (member.equals("locked")) {
                        return core.isLocked(sone);
                } else if (member.equals("lastUpdatedText")) {
-                       return GetTimesAjaxPage.getTime((WebInterface) templateContext.get("webInterface"), System.currentTimeMillis() - sone.getTime());
+                       return GetTimesAjaxPage.getTime((WebInterface) templateContext.get("webInterface"), sone.getTime());
                } else if (member.equals("trust")) {
                        Sone currentSone = (Sone) templateContext.get("currentSone");
                        if (currentSone == null) {
@@ -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);
        }