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:
commit
ab4915edcb
|
@ -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 New Issue