Skip to content
Snippets Groups Projects
Commit e4899bd8 authored by lain's avatar lain
Browse files

Fix bug when no posts are in the db.

parent c6b9b777
Branches feld/pleroma-feld-mastodon-usersearch
No related tags found
No related merge requests found
......@@ -158,7 +158,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
# 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
......
......@@ -109,6 +109,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment