conversations =
Enum.map(participations, fn participation ->
- ConversationView.render("participation.json", %{participation: participation, user: user})
+ ConversationView.render("participation.json", %{participation: participation, for: user})
end)
conn
Repo.get_by(Participation, id: participation_id, user_id: user.id),
{:ok, participation} <- Participation.mark_as_read(participation) do
participation_view =
- ConversationView.render("participation.json", %{participation: participation, user: user})
+ ConversationView.render("participation.json", %{participation: participation, for: user})
conn
|> json(participation_view)
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.MastodonAPI.StatusView
- def render("participation.json", %{participation: participation, user: user}) do
+ def render("participation.json", %{participation: participation, for: user}) do
participation = Repo.preload(participation, conversation: [], recipients: [])
last_activity_id =
true <- user.id == participation.user_id do
conn
|> put_view(ConversationView)
- |> render("participation.json", %{participation: participation, user: user})
+ |> render("participation.json", %{participation: participation, for: user})
end
end
{:ok, _} <- 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
payload:
Pleroma.Web.MastodonAPI.ConversationView.render("participation.json", %{
participation: participation,
- user: participation.user
+ for: participation.user
})
|> Jason.encode!()
}
assert participation
conversation =
- ConversationView.render("participation.json", %{participation: participation, user: user})
+ ConversationView.render("participation.json", %{participation: participation, for: user})
assert conversation.id == participation.id |> to_string()
assert conversation.last_status.id == activity.id