api/statuses: allow quoting local statuses locally
This commit is contained in:
parent
731863af9c
commit
fd87664b9e
2 changed files with 18 additions and 3 deletions
|
|
@ -147,6 +147,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do
|
|||
quoting_visibility = CommonAPI.get_quoted_visibility(quoting)
|
||||
|
||||
quoting_visibility in ["public", "unlisted"] or
|
||||
(quoting_visibility == "local" && quote_visibility == quoting_visibility) or
|
||||
(quoting_visibility == "private" && quote_visibility == quoting_visibility &&
|
||||
actor == quoted_author)
|
||||
end
|
||||
|
|
@ -171,7 +172,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do
|
|||
draft,
|
||||
dgettext(
|
||||
"errors",
|
||||
"You can only quote public or unlisted statuses and your own private posts"
|
||||
"You cannot quote this status at all or not with the intended visibility"
|
||||
)
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2542,7 +2542,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
|
||||
assert %{
|
||||
"error" =>
|
||||
"You can only quote public or unlisted statuses and your own private posts"
|
||||
"You cannot quote this status at all or not with the intended visibility"
|
||||
} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|
|
@ -2572,7 +2572,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
|
||||
assert %{
|
||||
"error" =>
|
||||
"You can only quote public or unlisted statuses and your own private posts"
|
||||
"You cannot quote this status at all or not with the intended visibility"
|
||||
} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|
|
@ -2584,6 +2584,20 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
|> json_response_and_validate_schema(422)
|
||||
end
|
||||
|
||||
test "posting a quote, quoting a local post locally", %{conn: conn} do
|
||||
other = insert(:user)
|
||||
{:ok, local_status} = CommonAPI.post(other, %{status: "epsilon", visibility: "local"})
|
||||
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/statuses", %{
|
||||
"status" => "greater than zero",
|
||||
"visibility" => "local",
|
||||
"quoted_status_id" => local_status.id
|
||||
})
|
||||
|> json_response_and_validate_schema(200)
|
||||
end
|
||||
|
||||
test "posting a quote, after quote, the status gets deleted", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue