X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUnlikeAjaxPage.java;h=bd5f91ba7da7c92460b78c74996650ac04a38d12;hb=24a1147058b1a8e4c3021dd61b0b24d4e350eabb;hp=5ac0ca04a5dd5f7a3a6053e2d60359005719a5d2;hpb=95638f1b175255f63ca23f8292d71b8ee1a93de7;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/UnlikeAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/UnlikeAjaxPage.java index 5ac0ca0..bd5f91b 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/UnlikeAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/UnlikeAjaxPage.java @@ -18,6 +18,7 @@ package net.pterodactylus.sone.web.ajax; import net.pterodactylus.sone.data.Post; +import net.pterodactylus.sone.data.PostReply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; @@ -59,7 +60,10 @@ public class UnlikeAjaxPage extends JsonPage { } webInterface.getCore().touchConfiguration(); } else if ("reply".equals(type)) { - currentSone.removeLikedReplyId(id); + Optional postReply = webInterface.getCore().getDatabase().getPostReply(id); + if (postReply.isPresent()) { + postReply.get().unlike(currentSone); + } webInterface.getCore().touchConfiguration(); } else { return createErrorJsonObject("invalid-type");