mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +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
|
||||
|
||||
def update_changeset(filter, attrs) do
|
||||
changeset(filter, attrs)
|
||||
changeset(filter, strip_name_if_default(filter, attrs))
|
||||
end
|
||||
|
||||
def deletion_changeset(filter) do
|
||||
|
@ -86,4 +86,9 @@ defmodule Philomena.Filters.Filter do
|
|||
changeset
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue