mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
fix error when changing name to existing one (fixes philomena-dev/philomena#45)
This commit is contained in:
parent
cc571a38c2
commit
f4b7cc5f5f
2 changed files with 5 additions and 5 deletions
|
@ -603,7 +603,7 @@ defmodule Philomena.Users do
|
|||
|> Multi.update(:account, account)
|
||||
|> Repo.transaction()
|
||||
|> case do
|
||||
{:ok, %{account: %{name: new_name}}} = result ->
|
||||
{:ok, %{account: %{name: new_name}}} ->
|
||||
spawn(fn ->
|
||||
Images.user_name_reindex(old_name, new_name)
|
||||
Comments.user_name_reindex(old_name, new_name)
|
||||
|
@ -612,10 +612,10 @@ defmodule Philomena.Users do
|
|||
Reports.user_name_reindex(old_name, new_name)
|
||||
end)
|
||||
|
||||
result
|
||||
{:ok, account}
|
||||
|
||||
result ->
|
||||
result
|
||||
{:error, :account, changeset, _changes} ->
|
||||
{:error, changeset}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ defmodule PhilomenaWeb.Registration.NameController do
|
|||
|> put_flash(:info, "Name successfully updated.")
|
||||
|> redirect(to: Routes.profile_path(conn, :show, user))
|
||||
|
||||
{:error, %{account: changeset}} ->
|
||||
{:error, changeset} ->
|
||||
render(conn, "edit.html", changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue