Store the insert URI in the information used for inserting.
[Sone.git] / src / main / java / net / pterodactylus / sone / fcp / CreateReplyCommand.java
index 9fc78d6..4a53238 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - CreateReplyCommand.java - Copyright © 2011 David Roden
+ * Sone - CreateReplyCommand.java - Copyright © 2011–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
@@ -45,15 +45,12 @@ public class CreateReplyCommand extends AbstractSoneCommand {
                super(core, true);
        }
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
-               Sone sone = getSone(parameters, "Sone", true);
+               Sone sone = getMandatoryLocalSone(parameters, "Sone");
                Post post = getPost(parameters, "Post");
                String text = getString(parameters, "Text");
-               PostReply reply = getCore().createReply(sone, post, text);
+               PostReply reply = sone.newPostReplyBuilder(post.getId()).withText(text).build(getCore().postReplyCreated());
                return new Response("ReplyCreated", new SimpleFieldSetBuilder().put("Reply", reply.getId()).get());
        }