ConversationView: Align parameter names with other views.
This commit is contained in:
parent
60231ec7bd
commit
511ccea5aa
@ -1743,7 +1743,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
|
|
||||||
conversations =
|
conversations =
|
||||||
Enum.map(participations, fn participation ->
|
Enum.map(participations, fn participation ->
|
||||||
ConversationView.render("participation.json", %{participation: participation, user: user})
|
ConversationView.render("participation.json", %{participation: participation, for: user})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
@ -1756,7 +1756,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
Repo.get_by(Participation, id: participation_id, user_id: user.id),
|
Repo.get_by(Participation, id: participation_id, user_id: user.id),
|
||||||
{:ok, participation} <- Participation.mark_as_read(participation) do
|
{:ok, participation} <- Participation.mark_as_read(participation) do
|
||||||
participation_view =
|
participation_view =
|
||||||
ConversationView.render("participation.json", %{participation: participation, user: user})
|
ConversationView.render("participation.json", %{participation: participation, for: user})
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> json(participation_view)
|
|> json(participation_view)
|
||||||
|
@ -11,7 +11,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
|
|||||||
alias Pleroma.Web.MastodonAPI.AccountView
|
alias Pleroma.Web.MastodonAPI.AccountView
|
||||||
alias Pleroma.Web.MastodonAPI.StatusView
|
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: [])
|
participation = Repo.preload(participation, conversation: [], recipients: [])
|
||||||
|
|
||||||
last_activity_id =
|
last_activity_id =
|
||||||
|
@ -18,7 +18,7 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIController do
|
|||||||
true <- user.id == participation.user_id do
|
true <- user.id == participation.user_id do
|
||||||
conn
|
conn
|
||||||
|> put_view(ConversationView)
|
|> put_view(ConversationView)
|
||||||
|> render("participation.json", %{participation: participation, user: user})
|
|> render("participation.json", %{participation: participation, for: user})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIController do
|
|||||||
{:ok, _} <- Participation.set_recipients(participation, recipients) do
|
{:ok, _} <- Participation.set_recipients(participation, recipients) do
|
||||||
conn
|
conn
|
||||||
|> put_view(ConversationView)
|
|> put_view(ConversationView)
|
||||||
|> render("participation.json", %{participation: participation, user: user})
|
|> render("participation.json", %{participation: participation, for: user})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -209,7 +209,7 @@ defmodule Pleroma.Web.Streamer do
|
|||||||
payload:
|
payload:
|
||||||
Pleroma.Web.MastodonAPI.ConversationView.render("participation.json", %{
|
Pleroma.Web.MastodonAPI.ConversationView.render("participation.json", %{
|
||||||
participation: participation,
|
participation: participation,
|
||||||
user: participation.user
|
for: participation.user
|
||||||
})
|
})
|
||||||
|> Jason.encode!()
|
|> Jason.encode!()
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationViewTest do
|
|||||||
assert participation
|
assert participation
|
||||||
|
|
||||||
conversation =
|
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.id == participation.id |> to_string()
|
||||||
assert conversation.last_status.id == activity.id
|
assert conversation.last_status.id == activity.id
|
||||||
|
Loading…
Reference in New Issue
Block a user