keep old slug when title is changed

This commit is contained in:
byte[] 2020-09-28 00:16:19 -04:00
parent a00cdab739
commit 014cb025fd

View file

@ -116,8 +116,6 @@ defmodule Philomena.Topics.Topic do
|> cast(attrs, [:title]) |> cast(attrs, [:title])
|> validate_required([:title]) |> validate_required([:title])
|> validate_length(:title, min: 4, max: 96, count: :bytes) |> validate_length(:title, min: 4, max: 96, count: :bytes)
|> put_slug()
|> unique_constraint(:slug, name: :index_topics_on_forum_id_and_slug)
end end
def put_slug(changeset) do def put_slug(changeset) do