Skip to content

Commit

Permalink
more descriptive error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Feb 13, 2023
1 parent 9b4a3be commit 1d1ec9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/plausible_web/controllers/site/membership_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ defmodule PlausibleWeb.Site.MembershipController do

message =
case errors do
%{invitation: [error | _]} -> String.capitalize(error)
%{invitation: ["already sent" | _]} -> "Invitation has already been sent"
_other -> "Site transfer request to #{email} has failed"
end

conn
|> put_flash(:ttl, :timer.seconds(5))
|> put_flash(:error_title, "Transfer error")
|> put_flash(:error, message)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do
conn = get(recycle(conn), redirected_to(conn, 302))
html = html_response(conn, 200)
assert html =~ "Transfer error"
assert html =~ "Already sent"
assert html =~ "Invitation has already been sent"
end
end

Expand Down

0 comments on commit 1d1ec9a

Please sign in to comment.