alias Pleroma.Conversation.Participation
alias Pleroma.Web.ActivityPub.ActivityPub
- alias Pleroma.Web.MastodonAPI.StatusView
alias Pleroma.Web.MastodonAPI.ConversationView
- alias Pleroma.Repo
+ alias Pleroma.Web.MastodonAPI.StatusView
+
+ def conversation(%{assigns: %{user: user}} = conn, %{"id" => participation_id}) do
+ with %Participation{} = participation <- Participation.get(participation_id),
+ true <- user.id == participation.user_id do
+ conn
+ |> put_view(ConversationView)
+ |> render("participation.json", %{participation: participation, for: user})
+ end
+ end
def conversation_statuses(
%{assigns: %{user: user}} = conn,
participation =
participation_id
- |> Participation.get()
- |> Repo.preload(:conversation)
+ |> Participation.get(preload: [:conversation])
if user.id == participation.user_id do
activities =
|> Participation.get()
with true <- user.id == participation.user_id,
- {:ok, _} <- Participation.set_recipients(participation, recipients) do
+ {:ok, participation} <- Participation.set_recipients(participation, recipients) do
conn
|> put_view(ConversationView)
- |> render("participation.json", %{participation: participation, user: user})
+ |> render("participation.json", %{participation: participation, for: user})
end
end
end