diff --git a/lib/frenzy_web/controllers/feed_controller.ex b/lib/frenzy_web/controllers/feed_controller.ex index db4f737..c66fcb5 100644 --- a/lib/frenzy_web/controllers/feed_controller.ex +++ b/lib/frenzy_web/controllers/feed_controller.ex @@ -43,7 +43,10 @@ defmodule FrenzyWeb.FeedController do prev_page_path = if !is_nil(first_item) && - Repo.exists?(from i in Item, where: i.date > ^first_item.date and i.feed_id == ^id) do + Repo.exists?( + from i in Item, + where: not i.tombstone and i.date > ^first_item.date and i.feed_id == ^id + ) do current_path(conn, %{after: first_item.id}) else nil @@ -51,7 +54,10 @@ defmodule FrenzyWeb.FeedController do next_page_path = if !is_nil(last_item) && - Repo.exists?(from i in Item, where: i.date < ^last_item.date and i.feed_id == ^id) do + Repo.exists?( + from i in Item, + where: not i.tombstone and i.date < ^last_item.date and i.feed_id == ^id + ) do current_path(conn, %{before: last_item.id}) else nil diff --git a/lib/frenzy_web/controllers/group_controller.ex b/lib/frenzy_web/controllers/group_controller.ex index 1570338..4fdcdcd 100644 --- a/lib/frenzy_web/controllers/group_controller.ex +++ b/lib/frenzy_web/controllers/group_controller.ex @@ -118,7 +118,8 @@ defmodule FrenzyWeb.GroupController do prev_page_path = if !is_nil(first_item) && Repo.exists?( - from i in Item, where: i.date > ^first_item.date and i.feed_id in ^feed_ids + from i in Item, + where: not i.tombstone and i.date > ^first_item.date and i.feed_id in ^feed_ids ) do current_path(conn, %{after: first_item.id}) else @@ -128,7 +129,8 @@ defmodule FrenzyWeb.GroupController do next_page_path = if !is_nil(last_item) && Repo.exists?( - from i in Item, where: i.date < ^last_item.date and i.feed_id in ^feed_ids + from i in Item, + where: not i.tombstone and i.date < ^last_item.date and i.feed_id in ^feed_ids ) do current_path(conn, %{before: last_item.id}) else