Fix existing member detection and add auto-detection

- Added debug logging to SocialContractPage and GroupJoinPage
- Implemented auto-detection: if invitee name matches existing contact, automatically set as existing member
- Sarah Johnson will now be automatically detected and routed to rCard selection
- Added debugging console logs to track invitation flow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
main
Claude Code Assistant 2 months ago
parent c28d62fb78
commit 7c31fe221a
  1. 7
      src/pages/GroupJoinPage.tsx
  2. 18
      src/pages/InvitationPage.tsx
  3. 9
      src/pages/SocialContractPage.tsx

@ -41,6 +41,13 @@ const GroupJoinPage = () => {
const groupId = searchParams.get('groupId');
const inviter = searchParams.get('inviterName') || 'Someone';
// Debug logging
console.log('GroupJoinPage - URL Parameters:', {
groupId,
inviter,
allParams: Object.fromEntries(searchParams.entries())
});
setInviterName(inviter);
if (groupId) {

@ -32,6 +32,7 @@ import {
import { QRCodeSVG } from 'qrcode.react';
import { dataService } from '../services/dataService';
import type { Group } from '../types/group';
import type { Contact } from '../types/contact';
const InvitationPage = () => {
const [invitationUrl, setInvitationUrl] = useState('');
@ -63,6 +64,23 @@ const InvitationPage = () => {
relationshipType: relationshipType || undefined,
});
// Auto-detect if invitee is an existing member by checking contacts
if (inviteeName) {
try {
const contacts: Contact[] = await dataService.getContacts();
const isExistingContact = contacts.some(contact =>
contact.name.toLowerCase() === inviteeName.toLowerCase()
);
if (isExistingContact) {
console.log(`Auto-detected ${inviteeName} as existing member`);
setIsExistingMember(true);
}
} catch (error) {
console.error('Failed to check contacts:', error);
}
}
if (groupId) {
setIsGroupInvite(true);
try {

@ -50,8 +50,17 @@ const SocialContractPage = () => {
const inviteId = searchParams.get('invite');
const existingMember = searchParams.get('existingMember') === 'true';
// Debug logging
console.log('SocialContract - URL Parameters:', {
groupId,
inviteId,
existingMember,
allParams: Object.fromEntries(searchParams.entries())
});
// If this is for an existing member and it's a group invite, redirect to group join page
if (existingMember && groupId) {
console.log('Redirecting existing member to GroupJoinPage');
const joinParams = new URLSearchParams(searchParams);
navigate(`/join-group?${joinParams.toString()}`);
return;

Loading…
Cancel
Save