Repository navigation
Fix/dreamsync bugs - #371
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughRefactors mutual chat creation across services to return { chat, wasCreated } and introduces a 15-second delay before messaging when a chat is newly created. Adds a 2-member DM fast-path and pre-check in group lookup/creation to avoid duplicate chats. Updates link building in notifications and expands logging. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Svc as Service (Consent/MatchNotification)
participant GroupSvc as GroupService
participant Store as Data Store
participant Msg as Messaging
Note over Svc: findOrCreateMutualChat(targetUserId)
Svc->>GroupSvc: findGroupByMembers([me, target])
alt Existing DM found
GroupSvc-->>Svc: { chat, wasCreated: false }
else Not found
Svc->>GroupSvc: createGroup(private, 2 members)
GroupSvc->>GroupSvc: pre-check existing DM
alt DM exists
GroupSvc-->>Svc: { chat: existing, wasCreated: false }
else Create new
GroupSvc->>Store: insert group
Store-->>GroupSvc: group
GroupSvc-->>Svc: { chat: new, wasCreated: true }
end
end
alt wasCreated == true
Note over Svc: Wait 15s to ensure chat readiness
end
Svc->>Msg: send initial messages to chat
sequenceDiagram
autonumber
participant Client as Caller (Any Service)
participant GroupSvc as GroupService
participant DB as DB
Note over Client,GroupSvc: findGroupByMembers([A,B])
alt Exactly 2 members
GroupSvc->>DB: query private groups with DreamSync Chat prefix
DB-->>GroupSvc: candidate groups
GroupSvc->>GroupSvc: filter exact 2-member match
GroupSvc-->>Client: DM or null
else Other sizes
GroupSvc->>DB: query private groups by members
DB-->>GroupSvc: result
GroupSvc-->>Client: group or null
end
Note over Client,GroupSvc: createGroup(private, [A,B])
GroupSvc->>GroupSvc: pre-check findGroupByMembers([A,B])
alt Found
GroupSvc-->>Client: existing group
else Not found
GroupSvc->>DB: insert new group
DB-->>GroupSvc: group
GroupSvc-->>Client: new group
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* chore: fix pictique user * fix: dreamsync bugs
Description of change
Issue Number
closes #370
closes #369
closes #368
Type of change
How the change has been tested
Change checklist
Summary by CodeRabbit