feat(invitations): redesign acceptance flow with inline auth and auto-join (closes Sentinent-AI/Sentinent#31)#53
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes Sentinent-AI/Sentinent#31
What changed
Invitation acceptance page — full state machine
Invite members page
POST /api/invitations/:token/resendand actually sends the email (previously it only copied the link locally)Workspace page
Other fixes
AuthService.getCurrentUserEmail()— decodes email from JWT for wrong-account detectionInvitationValidationmodel now carriesemailfieldfix(signup): frontend password min-length + surface real backend error messagesfix(members): 20s timeout on inviteMember so button never stays stuckfix(members):ChangeDetectorRef+try/finallyto force UI reset after invitefix(dashboard): TS2345 —unreadCountForaccepts string workspace id