mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-18 15:08:00 +01:00
34 lines
No EOL
764 B
Elixir
34 lines
No EOL
764 B
Elixir
defmodule PhilomenaWeb.Api.Rss.WatchedController do
|
|
use PhilomenaWeb, :controller
|
|
|
|
alias Philomena.Images.{Image, Query}
|
|
import Ecto.Query
|
|
|
|
def index(conn, _params) do
|
|
user = conn.assigns.current_user
|
|
filter = conn.assigns.compiled_filter
|
|
|
|
{:ok, query} = Query.compile(user, "my:watched")
|
|
|
|
images =
|
|
Image.search_records(
|
|
%{
|
|
query: %{
|
|
bool: %{
|
|
must: query,
|
|
must_not: [
|
|
filter,
|
|
%{term: %{hidden_from_users: true}}
|
|
]
|
|
}
|
|
},
|
|
sort: %{created_at: :desc}
|
|
},
|
|
conn.assigns.image_pagination,
|
|
Image |> preload(:tags)
|
|
)
|
|
|
|
conn
|
|
|> render("index.rss", images: images)
|
|
end
|
|
end |