mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
fixes #106: prevent renaming the default filter
This commit is contained in:
parent
d82bb4f33f
commit
1e794b11d8
1 changed files with 6 additions and 1 deletions
|
@ -59,7 +59,7 @@ defmodule Philomena.Filters.Filter do
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_changeset(filter, attrs) do
|
def update_changeset(filter, attrs) do
|
||||||
changeset(filter, attrs)
|
changeset(filter, strip_name_if_default(filter, attrs))
|
||||||
end
|
end
|
||||||
|
|
||||||
def deletion_changeset(filter) do
|
def deletion_changeset(filter) do
|
||||||
|
@ -86,4 +86,9 @@ defmodule Philomena.Filters.Filter do
|
||||||
changeset
|
changeset
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp strip_name_if_default(%{system: true, name: "Default"}, attrs),
|
||||||
|
do: Map.delete(attrs, "name")
|
||||||
|
|
||||||
|
defp strip_name_if_default(_filter, attrs), do: attrs
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue