Allow creation of posts with recipients using AJAX.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Nov 2010 19:17:06 +0000 (20:17 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Nov 2010 19:17:06 +0000 (20:17 +0100)
src/main/java/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.java

index 0d553cc..ce2462c 100644 (file)
@@ -48,11 +48,13 @@ public class CreatePostAjaxPage extends JsonPage {
                if (sone == null) {
                        return createErrorJsonObject("auth-required");
                }
+               String recipientId = request.getHttpRequest().getParam("recipient");
+               Sone recipient = webInterface.getCore().getSone(recipientId, false);
                String text = request.getHttpRequest().getParam("text");
                if ((text == null) || (text.trim().length() == 0)) {
                        return createErrorJsonObject("text-required");
                }
-               Post newPost = webInterface.getCore().createPost(sone, text);
+               Post newPost = webInterface.getCore().createPost(sone, recipient, text);
                return createSuccessJsonObject().put("postId", newPost.getId());
        }