If no current Sone exists, return an error.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / CreatePostPage.java
index f32e089..3e7622a 100644 (file)
@@ -19,6 +19,7 @@ package net.pterodactylus.sone.web;
 
 import static com.google.common.base.Optional.of;
 
+import net.pterodactylus.sone.data.Identified;
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.text.TextFilter;
@@ -52,9 +53,6 @@ public class CreatePostPage extends SoneTemplatePage {
        // TEMPLATEPATH METHODS
        //
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
                super.processTemplate(request, templateContext);
@@ -71,7 +69,7 @@ public class CreatePostPage extends SoneTemplatePage {
                                }
                                Optional<Sone> recipient = webInterface.getCore().getSone(recipientId);
                                text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
-                               webInterface.getCore().createPost(sender.get(), recipient, System.currentTimeMillis(), text);
+                               sender.get().newPostBuilder().to(recipient.transform(Identified.GET_ID)).withText(text).build(webInterface.getCore().postCreated());
                                throw new RedirectException(returnPage);
                        }
                        templateContext.set("errorTextEmpty", true);