Skip to content

Fix email validation not displaying in Collaborators modals#4838

Open
lmac-1 wants to merge 5 commits into
mainfrom
fix/collaborator-email-validation-display
Open

Fix email validation not displaying in Collaborators modals#4838
lmac-1 wants to merge 5 commits into
mainfrom
fix/collaborator-email-validation-display

Conversation

@lmac-1

@lmac-1 lmac-1 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Description

#4765 revealed that validation messages for the email field were not showing in the Add Collaborator(s) modal and Invite Collaborator modal. This PR ensures the validation appears for invalid email addresses.

Validation steps

Add Collaborators

  1. Add a collaborator to a workflow
  2. Type an invalid email address, for example lucy@local - check that the validation message appears - it should appear shortly after you stop typing
  3. Update to valid email address
  4. Validation message should disappear after same delay
  5. Verify that there isn't layout shift

Invite Collaborators

  1. Add a collaborator to a workflow with an email address that doesn't have a user account
  2. Taken to the "Invite Collaborator" modal
  3. Change the email address to be invalid
  4. Validation message should appear
  5. Verify that there isn't layout shift

Additional notes for the reviewer

  1. Validation message will appear 300ms after user stops typing. This is in line with other areas on the project.
  2. Email validation tidying up is addressed in a follow up PR (Consolidate email format validation onto a single canonical validator #4839) which will close Collaborator add form silently rejects emails accepted by user registration #4765

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

- Set action: :validate on the changeset in the validate handler so
  used_input? surfaces errors correctly for embedded schema fields
- Add phx-debounce="300" to the email input to avoid errors appearing
  on every keystroke
- Use a friendlier error message for invalid email format

Relates to #4765
@github-project-automation github-project-automation Bot moved this to New Issues in Core Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Security Review ✅

  • S0 (project scoping): N/A — changes only adjust client-side validation feedback (error message text, debounce, changeset :action) in the Add Collaborators modal; no new queries or data access introduced.
  • S1 (authorization): N/A — no new web-layer actions; the existing validate and add_collaborators handlers are unchanged in their authorization surface.
  • S2 (audit trail): N/A — no Repo.insert/update/delete or config-resource writes added.

@lmac-1 lmac-1 requested review from doc-han and josephjclark June 5, 2026 18:30

@doc-han doc-han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked just fine for me. I was surprised by the jump in the UI. The error message takes so much space shifting things away. I can see that wasn't introduced by this PR. Thanks!

Image Image

@lmac-1

lmac-1 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @doc-han. I will take a look at the UI shift tomorrow and see if it's an easy fix to bundle into this PR.

@lmac-1 lmac-1 changed the title Fix email validation not displaying in Add Collaborators modal Fix email validation not displaying in Collaborators modals Jun 9, 2026
@lmac-1 lmac-1 requested review from theroinaochieng and removed request for josephjclark June 9, 2026 06:01
lmac-1 added 2 commits June 9, 2026 07:10
- Position validation error absolutely to prevent layout shift in both
  Add and Invite Collaborator modals
- Fix Invite Collaborator not showing validation by adding missing
  changeset action and consistent error message
- Add phx-debounce to email input in Invite Collaborator modal
@lmac-1

lmac-1 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Hiya @doc-han great spot re layout shift. I've fixed this as it was an easy win.

Also I extended the validation fix to the "Invite Collaborators" modal. PR description is updated with new validation steps to test. Can you give this another test? Thank you.

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.3%. Comparing base (1f514b8) to head (7d84254).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4838   +/-   ##
=====================================
  Coverage   90.3%   90.3%           
=====================================
  Files        444     444           
  Lines      22607   22607           
=====================================
+ Hits       20419   20425    +6     
+ Misses      2188    2182    -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lmac-1 lmac-1 requested a review from doc-han June 9, 2026 07:23
@lmac-1

lmac-1 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

@theroinaochieng added you as a reviewer here. I'm just waiting for Farhan to give it a second review (see previous comment)

@doc-han doc-han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Image Image

@lmac-1

lmac-1 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @doc-han ! @theroinaochieng not sure if you want to do a final QA review before merging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New Issues

Development

Successfully merging this pull request may close these issues.

Collaborator add form silently rejects emails accepted by user registration

2 participants