From 7ee6bf379f771abb5c273b4d2401ac024e9331fc Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 2 Jan 2020 19:00:47 -0500 Subject: [PATCH] apparently that was necessary --- lib/philomena_web/controllers/api/json/posts_controller.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/philomena_web/controllers/api/json/posts_controller.ex b/lib/philomena_web/controllers/api/json/posts_controller.ex index aa63e641..014f567e 100644 --- a/lib/philomena_web/controllers/api/json/posts_controller.ex +++ b/lib/philomena_web/controllers/api/json/posts_controller.ex @@ -15,7 +15,7 @@ defmodule PhilomenaWeb.Api.Json.PostController do |> where(destroyed_content: false) |> 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) - |> preload([:user]) + |> preload([:user, :topic]) |> Repo.one() 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], p.topic_position >= ^(25 * (page - 1)) and p.topic_position < ^(25 * page)) |> order_by(asc: :topic_position) - |> preload([:user]) + |> preload([:user, :topic]) |> preload([_p, t, _f], topic: t) |> Repo.all()