Merge branch 'bugfix/post-empty-status' into 'develop'
status_controller.ex: Posting media status without content defined See merge request pleroma/pleroma!1735
This commit is contained in:
commit
50ab064353
|
@ -103,6 +103,10 @@ def create(%{assigns: %{user: user}} = conn, %{"status" => _} = params) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create(%{assigns: %{user: _user}} = conn, %{"media_ids" => _} = params) do
|
||||||
|
create(conn, Map.put(params, "status", ""))
|
||||||
|
end
|
||||||
|
|
||||||
@doc "GET /api/v1/statuses/:id"
|
@doc "GET /api/v1/statuses/:id"
|
||||||
def show(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
def show(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||||
with %Activity{} = activity <- Activity.get_by_id_with_object(id),
|
with %Activity{} = activity <- Activity.get_by_id_with_object(id),
|
||||||
|
|
|
@ -99,7 +99,7 @@ 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
|
test "posting an undefined status with an attachment", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
file = %Plug.Upload{
|
file = %Plug.Upload{
|
||||||
|
@ -114,8 +114,7 @@ test "posting an empty status with an attachment", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"media_ids" => [to_string(upload.id)],
|
"media_ids" => [to_string(upload.id)]
|
||||||
"status" => ""
|
|
||||||
})
|
})
|
||||||
|
|
||||||
assert json_response(conn, 200)
|
assert json_response(conn, 200)
|
||||||
|
|
Loading…
Reference in New Issue