apparently that was necessary

This commit is contained in:
byte[] 2020-01-02 19:00:47 -05:00
parent ae5bfe14e4
commit 7ee6bf379f

View file

@ -15,7 +15,7 @@ defmodule PhilomenaWeb.Api.Json.PostController do
|> where(destroyed_content: false) |> where(destroyed_content: false)
|> where([_p, t], t.hidden_from_users == false and t.slug == ^topic_id) |> where([_p, t], t.hidden_from_users == false and t.slug == ^topic_id)
|> where([_p, _t, f], f.access_level == "normal" and f.short_name == ^forum_id) |> where([_p, _t, f], f.access_level == "normal" and f.short_name == ^forum_id)
|> preload([:user]) |> preload([:user, :topic])
|> Repo.one() |> Repo.one()
cond do cond do
@ -40,7 +40,7 @@ defmodule PhilomenaWeb.Api.Json.PostController do
|> where([_p, _t, f], f.access_level == "normal" and f.short_name == ^forum_id) |> where([_p, _t, f], f.access_level == "normal" and f.short_name == ^forum_id)
|> where([p], p.topic_position >= ^(25 * (page - 1)) and p.topic_position < ^(25 * page)) |> where([p], p.topic_position >= ^(25 * (page - 1)) and p.topic_position < ^(25 * page))
|> order_by(asc: :topic_position) |> order_by(asc: :topic_position)
|> preload([:user]) |> preload([:user, :topic])
|> preload([_p, t, _f], topic: t) |> preload([_p, t, _f], topic: t)
|> Repo.all() |> Repo.all()