Fix Reblog API
Do not set visibility parameter to `public` by default and let CommonAPI to infer it from status.
This commit is contained in:
parent
732cc0ce46
commit
1b79dce7bc
@ -117,7 +117,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
|
||||
request_body("Parameters", %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
visibility: %Schema{allOf: [VisibilityScope], default: "public"}
|
||||
visibility: %Schema{allOf: [VisibilityScope]}
|
||||
}
|
||||
}),
|
||||
responses: %{
|
||||
|
@ -744,6 +744,17 @@ defmodule Pleroma.Web.CommonAPITest do
|
||||
refute Visibility.visible_for_user?(announce_activity, nil)
|
||||
end
|
||||
|
||||
test "author can repeat own private statuses" do
|
||||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"})
|
||||
|
||||
{:ok, %Activity{} = announce_activity} = CommonAPI.repeat(activity.id, user)
|
||||
|
||||
assert Visibility.is_private?(announce_activity)
|
||||
refute Visibility.visible_for_user?(announce_activity, nil)
|
||||
end
|
||||
|
||||
test "favoriting a status" do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
@ -954,6 +954,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
||||
|
||||
assert to_string(activity.id) == id
|
||||
end
|
||||
|
||||
test "author can reblog own private status", %{conn: conn, user: user} do
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"})
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/statuses/#{activity.id}/reblog")
|
||||
|
||||
assert %{
|
||||
"reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1},
|
||||
"reblogged" => true,
|
||||
"visibility" => "private"
|
||||
} = json_response_and_validate_schema(conn, 200)
|
||||
|
||||
assert to_string(activity.id) == id
|
||||
end
|
||||
end
|
||||
|
||||
describe "unreblogging" do
|
||||
|
Loading…
Reference in New Issue
Block a user