From c1d54de22a21d30125a4fe7ced0d6df47d844086 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 7 Sep 2020 23:38:27 -0400 Subject: [PATCH] fix changeset error when uploading avatar --- lib/philomena/users/user.ex | 2 ++ lib/philomena_web/controllers/avatar_controller.ex | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/philomena/users/user.ex b/lib/philomena/users/user.ex index 360f157b..05d6a01c 100644 --- a/lib/philomena/users/user.ex +++ b/lib/philomena/users/user.ex @@ -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) diff --git a/lib/philomena_web/controllers/avatar_controller.ex b/lib/philomena_web/controllers/avatar_controller.ex index 109fd337..50a30cf2 100644 --- a/lib/philomena_web/controllers/avatar_controller.ex +++ b/lib/philomena_web/controllers/avatar_controller.ex @@ -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