Move reply like functionality from Sone to Reply.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / UnlikePage.java
index 48e5ab7..fd9f4b1 100644 (file)
@@ -18,6 +18,7 @@
 package net.pterodactylus.sone.web;
 
 import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.web.page.FreenetRequest;
 import net.pterodactylus.util.template.Template;
@@ -63,7 +64,10 @@ public class UnlikePage extends SoneTemplatePage {
                                        post.get().unlike(currentSone);
                                }
                        } else if ("reply".equals(type)) {
-                               currentSone.removeLikedReplyId(id);
+                               Optional<PostReply> postReply = webInterface.getCore().getDatabase().getPostReply(id);
+                               if (postReply.isPresent()) {
+                                       postReply.get().unlike(currentSone);
+                               }
                        }
                        throw new RedirectException(returnPage);
                }