mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-11 11:49:15 +00:00
Cleanup ScheduledActivityView
This commit is contained in:
parent
0a5b106ddd
commit
8d31530119
1 changed files with 7 additions and 16 deletions
|
@ -7,11 +7,10 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityView do
|
||||||
|
|
||||||
alias Pleroma.ScheduledActivity
|
alias Pleroma.ScheduledActivity
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
alias Pleroma.Web.MastodonAPI.ScheduledActivityView
|
|
||||||
alias Pleroma.Web.MastodonAPI.StatusView
|
alias Pleroma.Web.MastodonAPI.StatusView
|
||||||
|
|
||||||
def render("index.json", %{scheduled_activities: scheduled_activities}) do
|
def render("index.json", %{scheduled_activities: scheduled_activities}) do
|
||||||
render_many(scheduled_activities, ScheduledActivityView, "show.json")
|
render_many(scheduled_activities, __MODULE__, "show.json")
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("show.json", %{scheduled_activity: %ScheduledActivity{} = scheduled_activity}) do
|
def render("show.json", %{scheduled_activity: %ScheduledActivity{} = scheduled_activity}) do
|
||||||
|
@ -24,12 +23,8 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityView do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp with_media_attachments(data, %{params: %{"media_attachments" => media_attachments}}) do
|
defp with_media_attachments(data, %{params: %{"media_attachments" => media_attachments}}) do
|
||||||
try do
|
|
||||||
attachments = render_many(media_attachments, StatusView, "attachment.json", as: :attachment)
|
attachments = render_many(media_attachments, StatusView, "attachment.json", as: :attachment)
|
||||||
Map.put(data, :media_attachments, attachments)
|
Map.put(data, :media_attachments, attachments)
|
||||||
rescue
|
|
||||||
_ -> data
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp with_media_attachments(data, _), do: data
|
defp with_media_attachments(data, _), do: data
|
||||||
|
@ -45,13 +40,9 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityView do
|
||||||
in_reply_to_id: params["in_reply_to_id"]
|
in_reply_to_id: params["in_reply_to_id"]
|
||||||
}
|
}
|
||||||
|
|
||||||
data =
|
case params["media_ids"] do
|
||||||
if media_ids = params["media_ids"] do
|
nil -> data
|
||||||
Map.put(data, :media_ids, media_ids)
|
media_ids -> Map.put(data, :media_ids, media_ids)
|
||||||
else
|
end
|
||||||
data
|
|
||||||
end
|
|
||||||
|
|
||||||
data
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue