X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FLikeReplyCommand.java;h=acdfb98ac5db5e0981af6f99daa4f19f7568f221;hp=a9795b2450b3a8250336440948924f61702eb1bb;hb=faf66247a34f64946990a985d2ea3003465969cb;hpb=67c17c2691e1c00026ed329e8a379a597e4f8ef4 diff --git a/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java b/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java index a9795b2..acdfb98 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java @@ -1,5 +1,5 @@ /* - * Sone - LikeReplyCommand.java - Copyright © 2011 David Roden + * Sone - LikeReplyCommand.java - Copyright © 2011–2020 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 @@ -18,17 +18,14 @@ package net.pterodactylus.sone.fcp; import net.pterodactylus.sone.core.Core; -import net.pterodactylus.sone.data.Reply; +import net.pterodactylus.sone.data.PostReply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder; import net.pterodactylus.sone.freenet.fcp.FcpException; import freenet.support.SimpleFieldSet; -import freenet.support.api.Bucket; /** * Implements the “LikeReply” FCP command which allows the user to like a reply. - * - * @author David ‘Bombe’ Roden */ public class LikeReplyCommand extends AbstractSoneCommand { @@ -39,16 +36,16 @@ public class LikeReplyCommand extends AbstractSoneCommand { * The Sone core */ protected LikeReplyCommand(Core core) { - super(core); + super(core, true); } /** * {@inheritDoc} */ @Override - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { - Reply reply = getReply(parameters, "Reply"); - Sone sone = getSone(parameters, "Sone"); + public Response execute(SimpleFieldSet parameters) throws FcpException { + PostReply reply = getReply(parameters, "Reply"); + Sone sone = getSone(parameters, "Sone", true); sone.addLikedReplyId(reply.getId()); return new Response("ReplyLiked", new SimpleFieldSetBuilder().put("LikeCount", getCore().getLikes(reply).size()).get()); }