Fix preview not being usable in form data
authorrinpatch <rinpatch@sdf.org>
Tue, 2 Apr 2019 20:07:16 +0000 (23:07 +0300)
committerrinpatch <rinpatch@sdf.org>
Tue, 2 Apr 2019 20:07:16 +0000 (23:07 +0300)
docs/api/differences_in_mastoapi_responses.md
lib/pleroma/web/common_api/common_api.ex

index 7adf2967601f5fe0fe2f101905dd9e6279384e3d..215f43155298abb76e8a2a42aa57749a835c4ab1 100644 (file)
@@ -47,6 +47,6 @@ Has these additional fields under the `pleroma` object:
 
 ## POST `/api/v1/statuses`
 
-Additional parameters can be added to the JSON body:
+Additional parameters can be added to the JSON body/Form data:
 
 - `preview`: boolean, if set to `true` the post won't be actually posted, but the status entitiy would still be rendered back. This could be useful for previewing rich text/custom emoji, for example.
index 2f82a32f3494b6b75f7ef1de62f82b7769488a14..745d1839bf2476b40ad27d4a74d4b4eb3a014a6e 100644 (file)
@@ -180,7 +180,7 @@ defmodule Pleroma.Web.CommonAPI do
             object: object,
             additional: %{"cc" => cc, "directMessage" => visibility == "direct"}
           },
-          data["preview"] || false
+          Pleroma.Web.ControllerHelper.truthy_param?(data["preview"]) || false
         )
 
       res