Move reply like functionality from Sone to Reply.
[Sone.git] / src / main / java / net / pterodactylus / sone / template / ReplyAccessor.java
index 7b89713..e81c819 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - ReplyAccessor.java - Copyright © 2010 David Roden
+ * Sone - ReplyAccessor.java - Copyright © 2010–2013 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,17 +46,14 @@ public class ReplyAccessor extends ReflectionAccessor {
                this.core = core;
        }
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public Object get(TemplateContext templateContext, Object object, String member) {
                PostReply reply = (PostReply) object;
                if ("likes".equals(member)) {
-                       return core.getLikes(reply);
+                       return reply.getLikes();
                } else if (member.equals("liked")) {
                        Sone currentSone = (Sone) templateContext.get("currentSone");
-                       return (currentSone != null) && (currentSone.isLikedReplyId(reply.getId()));
+                       return (currentSone != null) && reply.isLiked(currentSone);
                } else if (member.equals("new")) {
                        return !reply.isKnown();
                } else if (member.equals("loaded")) {