don't recode tag slugs, fixes #18

This commit is contained in:
byte[] 2020-09-10 11:20:25 -04:00
parent 912e64559b
commit ecfe60bcaa
7 changed files with 1 additions and 25 deletions

View file

@ -5,8 +5,6 @@ defmodule PhilomenaWeb.Api.Json.TagController do
alias Philomena.Repo
import Ecto.Query
plug PhilomenaWeb.RecodeParameterPlug, [name: "id"] when action in [:show]
def show(conn, %{"id" => slug}) do
tag =
Tag

View file

@ -7,7 +7,6 @@ defmodule PhilomenaWeb.Filter.HideController do
plug PhilomenaWeb.FilterBannedUsersPlug
plug :authorize_filter
plug PhilomenaWeb.RecodeParameterPlug, name: "tag"
plug :load_resource, model: Tag, id_field: "slug", id_name: "tag", persisted: true
def create(conn, _params) do

View file

@ -7,7 +7,6 @@ defmodule PhilomenaWeb.Filter.SpoilerController do
plug PhilomenaWeb.FilterBannedUsersPlug
plug :authorize_filter
plug PhilomenaWeb.RecodeParameterPlug, name: "tag"
plug :load_resource, model: Tag, id_field: "slug", id_name: "tag", persisted: true
def create(conn, _params) do

View file

@ -4,7 +4,6 @@ defmodule PhilomenaWeb.Tag.WatchController do
alias Philomena.Tags.Tag
alias Philomena.Users
plug PhilomenaWeb.RecodeParameterPlug, name: "tag_id"
plug :load_resource, model: Tag, id_field: "slug", id_name: "tag_id", persisted: true
def create(conn, _params) do

View file

@ -9,7 +9,6 @@ defmodule PhilomenaWeb.TagController do
alias Philomena.Interactions
import Ecto.Query
plug PhilomenaWeb.RecodeParameterPlug, [name: "id"] when action in [:show]
plug PhilomenaWeb.CanaryMapPlug, update: :edit
plug :load_and_authorize_resource,

View file

@ -1,18 +0,0 @@
defmodule PhilomenaWeb.RecodeParameterPlug do
def init(opts), do: opts
def call(conn, name: name) do
fixed_value =
conn
|> Map.get(:params)
|> Map.get(name)
|> to_string()
|> URI.encode_www_form()
|> String.replace("%2B", "+")
|> String.replace("%25", "%")
params = Map.put(conn.params, name, fixed_value)
%{conn | params: params}
end
end

View file

@ -10,7 +10,7 @@ span.tag.dropdown data-tag-category="#{@tag.category}" data-tag-id="#{@tag.id}"
span.tag__state.hidden title="Hidden"
| H
a.tag__name< href="/tags/#{@tag.slug}" title="#{@tag.short_description}" = @tag.name
a.tag__name< href=Routes.tag_path(@conn, :show, @tag) title="#{@tag.short_description}" = @tag.name
div.dropdown__content
a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unwatch" href=Routes.tag_watch_path(@conn, :delete, @tag) Unwatch