Fix bug when no posts are in the db.
This commit is contained in:
parent
8a1a7191fd
commit
046bee34d3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user