Skip to content

feat(invitations): redesign acceptance flow with inline auth and auto-join (closes Sentinent-AI/Sentinent#31)#53

Merged
neethika12 merged 8 commits into
mainfrom
feature/invitation-acceptance-flow
Apr 29, 2026
Merged

feat(invitations): redesign acceptance flow with inline auth and auto-join (closes Sentinent-AI/Sentinent#31)#53
neethika12 merged 8 commits into
mainfrom
feature/invitation-acceptance-flow

Conversation

@neethika12
Copy link
Copy Markdown
Contributor

Closes Sentinent-AI/Sentinent#31

What changed

Invitation acceptance page — full state machine

  • Not logged in → shows workspace details + inline Sign In / Create Account forms pre-filled with the invited email
  • After signup → auto-login then auto-accept; user lands directly in the workspace with no extra steps
  • After sign-in → auto-accept immediately
  • Wrong email logged in → shows "You are signed in as X but this invitation was sent to Y"
  • Loading spinner while the token is being validated

Invite members page

  • Resend button now calls POST /api/invitations/:token/resend and actually sends the email (previously it only copied the link locally)
  • Resend success/error message appears directly under the row — not at the top of the page — and auto-clears after 4s
  • Invitations load correctly on first tab open (was showing blank until you typed)
  • Accepted invitations appear in their own green Accepted section below Pending

Workspace page

  • Member count shown in the metrics bar
  • Team strip in the workspace hero with avatar, email, and colour-coded role badge (owner / member / viewer)
  • "Manage members →" link

Other fixes

  • AuthService.getCurrentUserEmail() — decodes email from JWT for wrong-account detection
  • InvitationValidation model now carries email field
  • fix(signup): frontend password min-length + surface real backend error messages
  • fix(members): 20s timeout on inviteMember so button never stays stuck
  • fix(members): ChangeDetectorRef + try/finally to force UI reset after invite
  • fix(dashboard): TS2345 — unreadCountFor accepts string workspace id

Add RxJS timeout(20000) to inviteMember() so the Sending... button
always resets — even if the backend is unreachable or crashes mid-
response — instead of staying stuck indefinitely.
- Inject ChangeDetectorRef and call detectChanges() in both next and
  error callbacks so the Sending... button always resets even when
  Angular's default change detection misses the update
- Wrap next callback body in try/finally so isSubmittingInvite is
  guaranteed to be reset even if any inner statement throws
- Validate password >= 8 chars on the frontend before sending,
  matching the backend rule (avoids a confusing generic error)
- Show the actual backend error message for 400 responses instead
  of always falling back to 'Registration failed. Please try again.'
- Separate 409 conflict message to 'An account with this email
  already exists.'
…-join

Replaces the single-state invitation page with a full state machine:

  loading → auth-choice → sign-in / sign-up → join → success / error

Changes:
- auth-choice: if not logged in, show workspace details and two options
  (Sign In / Create Account) instead of immediately redirecting to /login
- sign-in inline form: after login, auto-accept the invitation so the user
  lands directly in the workspace without an extra click
- sign-up inline form: pre-filled with the invited email; after signup, auto-
  login then auto-accept — user joins in one flow with no extra steps
- wrong-email: if logged in with a different email, show an explicit message:
  'You are signed in as X but this invitation was sent to Y'
- getCurrentUserEmail(): new AuthService method that decodes email from JWT
- InvitationValidation model now includes email field
- WorkspaceMemberService maps email from ValidateInvitation response
- Loading spinner while token is being validated
Fixes five issues on the invite members page and workspace view:

1. Resend feedback position — success/error now appears directly under
   the Resend button on each row, not at the top of the page. Per-row
   resendStates map keyed by invitation id; auto-clears after 4s.

2. Resend actually sends email — calls POST /api/invitations/:token/resend
   via new WorkspaceMemberService.resendInvitation(). Previously it only
   copied the link locally with no HTTP call.

3. Initial load showing nothing — added cdr.detectChanges() inside
   loadMembers() and loadInvitations() so Angular picks up the async
   updates immediately on first open.

4. Accepted invitations section — ListInvitations now returns all
   invitations (pending + accepted). Frontend splits them into
   pendingInvitations and acceptedInvitations; accepted rows show a
   green 'Accepted' chip and the accepted date instead of action buttons.

5. Member count and names in workspace — WorkspaceDetailsComponent now
   loads members on init and shows a team strip in the workspace hero
   with avatar, email, and colour-coded role badge (owner/member/viewer)
   plus a member count in the metrics bar and a 'Manage members' link.
@neethika12 neethika12 merged commit 6bda3aa into main Apr 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: redesign invitation acceptance flow with inline signup/login and auto-join

1 participant