mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
fix changeset error when uploading avatar
This commit is contained in:
parent
c9331f61b4
commit
c1d54de22a
2 changed files with 3 additions and 1 deletions
|
@ -368,6 +368,7 @@ defmodule Philomena.Users.User do
|
||||||
:avatar_width,
|
:avatar_width,
|
||||||
:avatar_height,
|
:avatar_height,
|
||||||
:avatar_size,
|
:avatar_size,
|
||||||
|
:avatar_mime_type,
|
||||||
:uploaded_avatar,
|
:uploaded_avatar,
|
||||||
:removed_avatar
|
:removed_avatar
|
||||||
])
|
])
|
||||||
|
@ -376,6 +377,7 @@ defmodule Philomena.Users.User do
|
||||||
:avatar_width,
|
:avatar_width,
|
||||||
:avatar_height,
|
:avatar_height,
|
||||||
:avatar_size,
|
:avatar_size,
|
||||||
|
:avatar_mime_type,
|
||||||
:uploaded_avatar
|
:uploaded_avatar
|
||||||
])
|
])
|
||||||
|> validate_number(:avatar_size, greater_than: 0, less_than_or_equal_to: 300_000)
|
|> validate_number(:avatar_size, greater_than: 0, less_than_or_equal_to: 300_000)
|
||||||
|
|
|
@ -20,7 +20,7 @@ defmodule PhilomenaWeb.AvatarController do
|
||||||
|> put_flash(:info, "Successfully updated avatar.")
|
|> put_flash(:info, "Successfully updated avatar.")
|
||||||
|> redirect(to: Routes.avatar_path(conn, :edit))
|
|> redirect(to: Routes.avatar_path(conn, :edit))
|
||||||
|
|
||||||
{:error, :user, changeset, _changes} ->
|
{:error, changeset} ->
|
||||||
render(conn, "edit.html", changeset: changeset)
|
render(conn, "edit.html", changeset: changeset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue