Merge branch 'fix/empty-attachment-statuses' into 'develop'
Fix not being able to post empty statuses with attachments See merge request pleroma/pleroma!1734
This commit is contained in:
commit
a0f42ecbca
|
@ -40,11 +40,11 @@ def create(user, params) do
|
||||||
|> put_params(params)
|
|> put_params(params)
|
||||||
|> status()
|
|> status()
|
||||||
|> summary()
|
|> summary()
|
||||||
|
|> with_valid(&attachments/1)
|
||||||
|> full_payload()
|
|> full_payload()
|
||||||
|> expires_at()
|
|> expires_at()
|
||||||
|> poll()
|
|> poll()
|
||||||
|> with_valid(&in_reply_to/1)
|
|> with_valid(&in_reply_to/1)
|
||||||
|> with_valid(&attachments/1)
|
|
||||||
|> with_valid(&in_reply_to_conversation/1)
|
|> with_valid(&in_reply_to_conversation/1)
|
||||||
|> with_valid(&visibility/1)
|
|> with_valid(&visibility/1)
|
||||||
|> content()
|
|> content()
|
||||||
|
|
|
@ -99,6 +99,28 @@ test "posting a status", %{conn: conn} do
|
||||||
NaiveDateTime.to_iso8601(expiration.scheduled_at)
|
NaiveDateTime.to_iso8601(expiration.scheduled_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "posting an empty status with an attachment", %{conn: conn} do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
file = %Plug.Upload{
|
||||||
|
content_type: "image/jpg",
|
||||||
|
path: Path.absname("test/fixtures/image.jpg"),
|
||||||
|
filename: "an_image.jpg"
|
||||||
|
}
|
||||||
|
|
||||||
|
{:ok, upload} = ActivityPub.upload(file, actor: user.ap_id)
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> assign(:user, user)
|
||||||
|
|> post("/api/v1/statuses", %{
|
||||||
|
"media_ids" => [to_string(upload.id)],
|
||||||
|
"status" => ""
|
||||||
|
})
|
||||||
|
|
||||||
|
assert json_response(conn, 200)
|
||||||
|
end
|
||||||
|
|
||||||
test "replying to a status", %{conn: conn} do
|
test "replying to a status", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
{:ok, replied_to} = CommonAPI.post(user, %{"status" => "cofe"})
|
{:ok, replied_to} = CommonAPI.post(user, %{"status" => "cofe"})
|
||||||
|
|
Loading…
Reference in New Issue