Participations: Filter out participations without activities.
This commit is contained in:
parent
0eb7464c10
commit
a3a7178b60
2 changed files with 14 additions and 0 deletions
|
@ -79,5 +79,6 @@ defmodule Pleroma.Conversation.Participation do
|
|||
| last_activity_id: activity_id
|
||||
}
|
||||
end)
|
||||
|> Enum.filter(& &1.last_activity_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,4 +86,17 @@ defmodule Pleroma.Conversation.ParticipationTest do
|
|||
|
||||
assert participation_one.last_activity_id == activity_three.id
|
||||
end
|
||||
|
||||
test "Doesn't die when the conversation gets empty" do
|
||||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "direct"})
|
||||
[participation] = Participation.for_user_with_last_activity_id(user)
|
||||
|
||||
assert participation.last_activity_id == activity.id
|
||||
|
||||
{:ok, _} = CommonAPI.delete(activity.id, user)
|
||||
|
||||
[] = Participation.for_user_with_last_activity_id(user)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue