fix warning in conversation controller

This commit is contained in:
byte[] 2019-12-21 09:46:58 -05:00
parent edc2b0c5d3
commit 9cef212ed2

View file

@ -13,19 +13,17 @@ defmodule PhilomenaWeb.ConversationController do
def index(conn, %{"with" => partner}) do def index(conn, %{"with" => partner}) do
user = conn.assigns.current_user user = conn.assigns.current_user
conversations = Conversation
Conversation |> where([c], (c.from_id == ^user.id and c.to_id == ^partner and not c.from_hidden) or (c.to_id == ^user.id and c.from_id == ^partner and not c.to_hidden))
|> where([c], (c.from_id == ^user.id and c.to_id == ^partner and not c.from_hidden) or (c.to_id == ^user.id and c.from_id == ^partner and not c.to_hidden)) |> load_conversations(conn)
|> load_conversations(conn)
end end
def index(conn, _params) do def index(conn, _params) do
user = conn.assigns.current_user user = conn.assigns.current_user
conversations = Conversation
Conversation |> where([c], (c.from_id == ^user.id and not c.from_hidden) or (c.to_id == ^user.id and not c.to_hidden))
|> where([c], (c.from_id == ^user.id and not c.from_hidden) or (c.to_id == ^user.id and not c.to_hidden)) |> load_conversations(conn)
|> load_conversations(conn)
end end
defp load_conversations(queryable, conn) do defp load_conversations(queryable, conn) do