updated tests
This commit is contained in:
parent
179fa32dd5
commit
494bb6bac6
3 changed files with 35 additions and 26 deletions
|
|
@ -44,6 +44,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
alias Pleroma.Web.OAuth.Authorization
|
||||
alias Pleroma.Web.OAuth.Scopes
|
||||
alias Pleroma.Web.OAuth.Token
|
||||
alias Pleroma.Web.RichMedia
|
||||
alias Pleroma.Web.TwitterAPI.TwitterAPI
|
||||
|
||||
alias Pleroma.Web.ControllerHelper
|
||||
|
|
@ -1530,19 +1531,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
end
|
||||
end
|
||||
|
||||
def status_card(%{assigns: %{user: user}} = conn, %{"id" => status_id}) do
|
||||
with %Activity{} = activity <- Activity.get_by_id(status_id),
|
||||
def status_card(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||
with %Activity{} = activity <- Activity.get_by_id(id),
|
||||
true <- Visibility.visible_for_user?(activity, user) do
|
||||
data =
|
||||
StatusView.render(
|
||||
"card.json",
|
||||
Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
||||
)
|
||||
data = RichMedia.Helpers.fetch_data_for_activity(activity)
|
||||
|
||||
json(conn, data)
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|> render("card.json", data)
|
||||
else
|
||||
_e ->
|
||||
json(conn, %{})
|
||||
_e -> {:error, :not_found}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -343,9 +343,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
}
|
||||
end
|
||||
|
||||
def render("card.json", _) do
|
||||
nil
|
||||
end
|
||||
def render("card.json", _), do: nil
|
||||
|
||||
def render("attachment.json", %{attachment: attachment}) do
|
||||
[attachment_url | _] = attachment["url"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue