fix changeset error when uploading avatar

This commit is contained in:
byte[] 2020-09-07 23:38:27 -04:00
parent c9331f61b4
commit c1d54de22a
2 changed files with 3 additions and 1 deletions

View file

@ -368,6 +368,7 @@ defmodule Philomena.Users.User do
:avatar_width,
:avatar_height,
:avatar_size,
:avatar_mime_type,
:uploaded_avatar,
:removed_avatar
])
@ -376,6 +377,7 @@ defmodule Philomena.Users.User do
:avatar_width,
:avatar_height,
:avatar_size,
:avatar_mime_type,
:uploaded_avatar
])
|> validate_number(:avatar_size, greater_than: 0, less_than_or_equal_to: 300_000)

View file

@ -20,7 +20,7 @@ defmodule PhilomenaWeb.AvatarController do
|> put_flash(:info, "Successfully updated avatar.")
|> redirect(to: Routes.avatar_path(conn, :edit))
{:error, :user, changeset, _changes} ->
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
end
end