mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-17 22:47:59 +01:00
add interactions, proper filtering to tag controller
This commit is contained in:
parent
a489d00aed
commit
06c48f6916
1 changed files with 7 additions and 2 deletions
|
@ -2,6 +2,7 @@ defmodule PhilomenaWeb.TagController do
|
|||
use PhilomenaWeb, :controller
|
||||
|
||||
alias Philomena.{Images.Image, Tags, Tags.Tag}
|
||||
alias Philomena.Interactions
|
||||
import Ecto.Query
|
||||
|
||||
def index(conn, params) do
|
||||
|
@ -25,13 +26,14 @@ defmodule PhilomenaWeb.TagController do
|
|||
tag = Tags.get_tag!(slug)
|
||||
|
||||
query = conn.assigns.compiled_filter
|
||||
user = conn.assigns.current_user
|
||||
|
||||
images =
|
||||
Image.search_records(
|
||||
%{
|
||||
query: %{
|
||||
bool: %{
|
||||
must_not: query,
|
||||
must_not: [query, %{term: %{hidden_from_users: true}}],
|
||||
must: %{term: %{"namespaced_tags.name": tag.name}}
|
||||
}
|
||||
},
|
||||
|
@ -41,6 +43,9 @@ defmodule PhilomenaWeb.TagController do
|
|||
Image |> preload([:tags, :user])
|
||||
)
|
||||
|
||||
render(conn, "show.html", tag: tag, images: images, layout_class: "layout--wide")
|
||||
interactions =
|
||||
Interactions.user_interactions(images, user)
|
||||
|
||||
render(conn, "show.html", tag: tag, interactions: interactions, images: images, layout_class: "layout--wide")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue