StatusView: add quote_visible
param
This commit is contained in:
parent
6f11f11519
commit
74e0a4555f
3 changed files with 9 additions and 0 deletions
|
@ -204,6 +204,10 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
||||||
nullable: true,
|
nullable: true,
|
||||||
description: "URL of the quoted status"
|
description: "URL of the quoted status"
|
||||||
},
|
},
|
||||||
|
quote_visible: %Schema{
|
||||||
|
type: :boolean,
|
||||||
|
description: "`true` if the quoted post is visible to the user"
|
||||||
|
},
|
||||||
local: %Schema{
|
local: %Schema{
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "`true` if the post was made on the local instance"
|
description: "`true` if the post was made on the local instance"
|
||||||
|
|
|
@ -432,6 +432,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
|
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
|
||||||
quote: quote_post,
|
quote: quote_post,
|
||||||
quote_url: object.data["quoteUrl"],
|
quote_url: object.data["quoteUrl"],
|
||||||
|
quote_visible: visible_for_user?(quote_activity, opts[:for]),
|
||||||
content: %{"text/plain" => content_plaintext},
|
content: %{"text/plain" => content_plaintext},
|
||||||
spoiler_text: %{"text/plain" => summary},
|
spoiler_text: %{"text/plain" => summary},
|
||||||
expires_at: expires_at,
|
expires_at: expires_at,
|
||||||
|
|
|
@ -328,6 +328,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
in_reply_to_account_acct: nil,
|
in_reply_to_account_acct: nil,
|
||||||
quote: nil,
|
quote: nil,
|
||||||
quote_url: nil,
|
quote_url: nil,
|
||||||
|
quote_visible: false,
|
||||||
content: %{"text/plain" => HTML.strip_tags(object_data["content"])},
|
content: %{"text/plain" => HTML.strip_tags(object_data["content"])},
|
||||||
spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])},
|
spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])},
|
||||||
expires_at: nil,
|
expires_at: nil,
|
||||||
|
@ -462,6 +463,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
# The quote isn't rendered
|
# The quote isn't rendered
|
||||||
refute status.pleroma.quote
|
refute status.pleroma.quote
|
||||||
assert status.pleroma.quote_url == private_object.data["id"]
|
assert status.pleroma.quote_url == private_object.data["id"]
|
||||||
|
refute status.pleroma.quote_visible
|
||||||
|
|
||||||
# After following the user, the quote is rendered
|
# After following the user, the quote is rendered
|
||||||
follower = insert(:user)
|
follower = insert(:user)
|
||||||
|
@ -469,6 +471,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
|
|
||||||
status = StatusView.render("show.json", %{activity: quote_private, for: follower})
|
status = StatusView.render("show.json", %{activity: quote_private, for: follower})
|
||||||
assert status.pleroma.quote.id == to_string(private.id)
|
assert status.pleroma.quote.id == to_string(private.id)
|
||||||
|
assert status.pleroma.quote_visible
|
||||||
end
|
end
|
||||||
|
|
||||||
test "quoted direct message" do
|
test "quoted direct message" do
|
||||||
|
@ -485,6 +488,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
# The quote isn't rendered
|
# The quote isn't rendered
|
||||||
refute status.pleroma.quote
|
refute status.pleroma.quote
|
||||||
assert status.pleroma.quote_url == direct_object.data["id"]
|
assert status.pleroma.quote_url == direct_object.data["id"]
|
||||||
|
refute status.pleroma.quote_visible
|
||||||
end
|
end
|
||||||
|
|
||||||
test "contains mentions" do
|
test "contains mentions" do
|
||||||
|
|
Loading…
Reference in a new issue