Commit 046bee34 authored by lain's avatar lain
Browse files

Fix bug when no posts are in the db.

parent 8a1a7191
......@@ -157,7 +157,7 @@ defp restrict_favorited_by(query, _), do: query
# Only search through last 100_000 activities by default
defp restrict_recent(query, _) do
since = Repo.aggregate(Activity, :max, :id) - 100_000
since = (Repo.aggregate(Activity, :max, :id) || 0) - 100_000
from activity in query,
where: activity.id > ^since
......
......@@ -82,6 +82,8 @@ test "retrieves activities that have a given context" do
describe "public fetch activities" do
test "retrieves public activities" do
activities = ActivityPub.fetch_public_activities
%{public: public} = ActivityBuilder.public_and_non_public
activities = ActivityPub.fetch_public_activities
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment