philomena/lib/philomena_web/controllers/api/rss/watched_controller.ex

19 lines
551 B
Elixir
Raw Normal View History

2019-12-04 01:50:23 +01:00
defmodule PhilomenaWeb.Api.Rss.WatchedController do
2019-12-01 00:11:24 +01:00
use PhilomenaWeb, :controller
alias PhilomenaWeb.ImageLoader
alias Philomena.Images.Image
alias Philomena.Elasticsearch
import Ecto.Query
2019-12-01 00:11:24 +01:00
def index(conn, _params) do
{:ok, {images, _tags}} = ImageLoader.search_string(conn, "my:watched")
images = Elasticsearch.search_records(images, preload(Image, tags: :aliases))
2019-12-01 00:11:24 +01:00
# NB: this is RSS, but using the RSS format causes Phoenix not to
# escape HTML
render(conn, "index.html", layout: false, images: images)
2019-12-01 00:11:24 +01:00
end
end