forked from AkkomaGang/akkoma
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 @@ def for_user_with_last_activity_id(user, params \\ %{}) do
|
||||||
| last_activity_id: activity_id
|
| last_activity_id: activity_id
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|> Enum.filter(& &1.last_activity_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,4 +86,17 @@ test "gets all the participations for a user, ordered by updated at descending"
|
||||||
|
|
||||||
assert participation_one.last_activity_id == activity_three.id
|
assert participation_one.last_activity_id == activity_three.id
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue