Fix pagination breaking on tombstoned items
This commit is contained in:
parent
4e79a1fe19
commit
28a35b8241
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user