improve transfer ownership error message - #2651
Conversation
BundleMonUnchanged files (7)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
5fa66a6 to
45fffd8
Compare
|
|
||
| message = | ||
| case errors do | ||
| %{invitation: [error | _]} -> String.capitalize(error) |
There was a problem hiding this comment.
:invitation is not a schema field, but a custom error key.
|> unique_constraint([:email, :site_id],
name: :invitations_site_id_email_index,
error_key: :invitation,
message: "invitation already exists"
)Should we still concat the other possible errors? I'm worried it might lead to confusing messages.
There was a problem hiding this comment.
Just the first one is fine. If anything confusing comes up we can address on case by case basis?
45fffd8 to
9dd6be2
Compare
aerosol
left a comment
There was a problem hiding this comment.
Tests fail. Please don't force push with ongoing review, it makes it more difficult to track changes. Thx.
|
Sorry, my bad. |
|
|
||
| message = | ||
| case errors do | ||
| %{invitation: ["already sent" | _]} -> "Invitation has already been sent" |
There was a problem hiding this comment.
To avoid failing tests, changing too much in a single PR, and to still show a reasonable error message, I decided to reuse the approach used for duplicate invitations above:
analytics/lib/plausible_web/controllers/site/membership_controller.ex
Lines 84 to 85 in 1d1ec9a
| role: "admin" | ||
| }) | ||
|
|
||
| conn = get(recycle(conn), redirected_to(conn, 302)) |
Changes
Fixes #2640 by adding a more descriptive error message in case a transfer to an invited (but not joined) user is requested.
Tests
Changelog
Documentation
Dark mode