mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
rely on query encoder to produce correct results
This commit is contained in:
parent
64884b3dc8
commit
6ce30ee27c
4 changed files with 4 additions and 22 deletions
|
@ -7,7 +7,7 @@ defmodule PhilomenaWeb.Filter.HideController do
|
|||
|
||||
plug PhilomenaWeb.FilterBannedUsersPlug
|
||||
plug :authorize_filter
|
||||
plug :load_tag
|
||||
plug :load_resource, model: Tag, id_field: "slug", id_name: "tag_id", persisted: true
|
||||
|
||||
def create(conn, _params) do
|
||||
case Filters.hide_tag(conn.assigns.current_filter, conn.assigns.tag) do
|
||||
|
@ -48,10 +48,4 @@ defmodule PhilomenaWeb.Filter.HideController do
|
|||
|> text("")
|
||||
end
|
||||
end
|
||||
|
||||
def load_tag(conn, _opts) do
|
||||
tag = Repo.get_by!(Tag, slug: URI.encode(conn.params["tag"]))
|
||||
|
||||
assign(conn, :tag, tag)
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@ defmodule PhilomenaWeb.Filter.SpoilerController do
|
|||
|
||||
plug PhilomenaWeb.FilterBannedUsersPlug
|
||||
plug :authorize_filter
|
||||
plug :load_tag
|
||||
plug :load_resource, model: Tag, id_field: "slug", id_name: "tag_id", persisted: true
|
||||
|
||||
def create(conn, _params) do
|
||||
case Filters.spoiler_tag(conn.assigns.current_filter, conn.assigns.tag) do
|
||||
|
@ -48,10 +48,4 @@ defmodule PhilomenaWeb.Filter.SpoilerController do
|
|||
|> text("")
|
||||
end
|
||||
end
|
||||
|
||||
def load_tag(conn, _opts) do
|
||||
tag = Repo.get_by!(Tag, slug: URI.encode(conn.params["tag"]))
|
||||
|
||||
assign(conn, :tag, tag)
|
||||
end
|
||||
end
|
|
@ -5,7 +5,7 @@ defmodule PhilomenaWeb.Tag.WatchController do
|
|||
alias Philomena.Users
|
||||
alias Philomena.Repo
|
||||
|
||||
plug :load_tag
|
||||
plug :load_resource, model: Tag, id_field: "slug", id_name: "tag_id", persisted: true
|
||||
|
||||
def create(conn, _params) do
|
||||
case Users.watch_tag(conn.assigns.current_user, conn.assigns.tag) do
|
||||
|
@ -34,10 +34,4 @@ defmodule PhilomenaWeb.Tag.WatchController do
|
|||
|> text("")
|
||||
end
|
||||
end
|
||||
|
||||
def load_tag(conn, _opts) do
|
||||
tag = Repo.get_by!(Tag, slug: URI.encode(conn.params["tag_id"]))
|
||||
|
||||
assign(conn, :tag, tag)
|
||||
end
|
||||
end
|
|
@ -35,7 +35,7 @@ defmodule PhilomenaWeb.TagController do
|
|||
|
||||
tag =
|
||||
Tag
|
||||
|> where(slug: ^URI.encode(slug))
|
||||
|> where(slug: ^slug)
|
||||
|> preload([:aliases, :implied_tags, :implied_by_tags, :dnp_entries, public_links: :user])
|
||||
|> Repo.one()
|
||||
|
||||
|
|
Loading…
Reference in a new issue