introduce max_id parameter in feed.atom
This commit is contained in:
parent
f0cde24f71
commit
9c61f60558
1 changed files with 6 additions and 0 deletions
|
@ -25,6 +25,7 @@ def feed(conn, %{"nickname" => nickname}) do
|
||||||
order_by: [desc: :id]
|
order_by: [desc: :id]
|
||||||
|
|
||||||
activities = query
|
activities = query
|
||||||
|
|> restrict_max(opts)
|
||||||
|> Repo.all
|
|> Repo.all
|
||||||
|
|
||||||
response = user
|
response = user
|
||||||
|
@ -54,6 +55,11 @@ defp decode_or_retry(body) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp restrict_max(query, %{"max_id" => max_id}) do
|
||||||
|
from activity in query, where: activity.id < ^max_id
|
||||||
|
end
|
||||||
|
defp restrict_max(query, _), do: query
|
||||||
|
|
||||||
def salmon_incoming(conn, _) do
|
def salmon_incoming(conn, _) do
|
||||||
{:ok, body, _conn} = read_body(conn)
|
{:ok, body, _conn} = read_body(conn)
|
||||||
{:ok, doc} = decode_or_retry(body)
|
{:ok, doc} = decode_or_retry(body)
|
||||||
|
|
Loading…
Reference in a new issue