Merge branch 'bugfix/956-activity-id-nil-conversations' into 'develop'

Participations: Filter out participations without activities.

Closes #956 and #953

See merge request pleroma/pleroma!1246
This commit is contained in:
Haelwenn 2019-06-04 15:34:55 +00:00
commit ab4915edcb
2 changed files with 14 additions and 0 deletions

View file

@ -79,5 +79,6 @@ defmodule Pleroma.Conversation.Participation do
| last_activity_id: activity_id
}
end)
|> Enum.filter(& &1.last_activity_id)
end
end

View file

@ -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