1
0
Fork 0
forked from mirrors/akkoma

Fix bug when no posts are in the db.

This commit is contained in:
Roger Braun 2017-11-05 12:05:25 +01:00
parent 8a1a7191fd
commit 046bee34d3
2 changed files with 3 additions and 1 deletions

View file

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

View file

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