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 =
|
prev_page_path =
|
||||||
if !is_nil(first_item) &&
|
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})
|
current_path(conn, %{after: first_item.id})
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
@ -51,7 +54,10 @@ defmodule FrenzyWeb.FeedController do
|
|||||||
|
|
||||||
next_page_path =
|
next_page_path =
|
||||||
if !is_nil(last_item) &&
|
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})
|
current_path(conn, %{before: last_item.id})
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
@ -118,7 +118,8 @@ defmodule FrenzyWeb.GroupController do
|
|||||||
prev_page_path =
|
prev_page_path =
|
||||||
if !is_nil(first_item) &&
|
if !is_nil(first_item) &&
|
||||||
Repo.exists?(
|
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
|
) do
|
||||||
current_path(conn, %{after: first_item.id})
|
current_path(conn, %{after: first_item.id})
|
||||||
else
|
else
|
||||||
@ -128,7 +129,8 @@ defmodule FrenzyWeb.GroupController do
|
|||||||
next_page_path =
|
next_page_path =
|
||||||
if !is_nil(last_item) &&
|
if !is_nil(last_item) &&
|
||||||
Repo.exists?(
|
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
|
) do
|
||||||
current_path(conn, %{before: last_item.id})
|
current_path(conn, %{before: last_item.id})
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user