ConversationView: fix last_status.account being empty, fix current user being included in group conversations
This commit is contained in:
parent
630eb0f939
commit
9b93eef715
2 changed files with 33 additions and 4 deletions
|
|
@ -34,14 +34,22 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
|
|||
|
||||
activity = Activity.get_by_id_with_object(last_activity_id)
|
||||
|
||||
# Conversations return all users except current user when current user is not only participant
|
||||
users = if length(participation.recipients) > 1 do
|
||||
Enum.reject(participation.recipients, &(&1.id == user.id))
|
||||
else
|
||||
participation.recipients
|
||||
end
|
||||
|
||||
%{
|
||||
id: participation.id |> to_string(),
|
||||
accounts: render(AccountView, "index.json", users: participation.recipients, for: user),
|
||||
accounts: render(AccountView, "index.json", users: users, for: user),
|
||||
unread: !participation.read,
|
||||
last_status:
|
||||
render(StatusView, "show.json",
|
||||
activity: activity,
|
||||
direct_conversation_id: participation.id
|
||||
direct_conversation_id: participation.id,
|
||||
for: user
|
||||
)
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue