feat: add direct contact button to flatmate profile sheet - #36
Conversation
- Add startConversation() to ChatsRepository for direct chat creation - Wire ChatActionsController with startConversation wrapper - Update FlatmateProfileSheet to use direct conversation (no like required) - Add trailing parameter to SwipeProfileDetailBody for Contact CTA - Contact button creates conversation immediately and navigates to chat
📝 WalkthroughWalkthroughThe change adds conversation creation through the chat repository and controller. Flatmate profile sheets now show a contact CTA for other users, create conversations, close the sheet, and navigate to chat. Profile detail bodies support optional trailing content. ChangesChat contact flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant FlatmateProfileSheet
participant ChatActionsController
participant ChatsRepository
participant ChatRouter
FlatmateProfileSheet->>ChatActionsController: startConversation(peerId)
ChatActionsController->>ChatsRepository: create conversation
ChatsRepository-->>ChatActionsController: conversation ID
ChatActionsController-->>FlatmateProfileSheet: conversation ID
FlatmateProfileSheet->>ChatRouter: dismiss sheet and open chat
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
PR Summary by QodoAdd Contact CTA to flatmate profile sheet for direct chat creation
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/features/discover/presentation/widgets/flatmate_profile_sheet.dart`:
- Line 98: Update the button callback invoking _handleContact to use a block
callback and wrap the returned Future<void> with unawaited(). Ensure the
required async utility import is available while preserving the existing
context, ref, and locale arguments.
- Around line 70-73: Update the Contact CTA rendering in the flatmate profile
sheet to require currentUserId to be non-null and different from userId. Use the
existing currentUserId and isSelf state in the relevant widget build logic,
ensuring the CTA remains hidden while bootstrapControllerProvider has no
resolved profile.
- Around line 59-62: Update the catch handling in
FlatmateProfileSheet._handleContact to convert the caught request error through
ErrorPresenter.fromDio() and the typed AppFailure flow, then present the
resulting actionable failure instead of always using locale.errorUnknown.
Preserve the context.mounted guard and remove the debugPrint/error.toString()
usage.
- Around line 23-24: Update the documentation link in the flatmate profile sheet
comment to reference ChatActionsController.startConversation instead of
ChatActionsController.matchIncomingLike, matching the action invoked by the
sheet.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 312ec578-6955-40cc-b514-6f7f85d61b85
📒 Files selected for processing (4)
lib/features/chats/application/chat_actions_controller.dartlib/features/chats/chats_repository.dartlib/features/discover/presentation/widgets/flatmate_profile_sheet.dartlib/features/swipe/presentation/widgets/swipe_profile_card.dart
Code Review by Qodo
Context used✅ Compliance rules (platform):
32 rules 1.
|
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- Fix doc comment: matchIncomingLike → startConversation - Fix isSelf null guard: require currentUserId non-null before showing CTA - Fix navigate-after-pop: capture GoRouter before popping sheet - Fix unawaited Future: wrap _handleContact in unawaited() - Fix in-flight guard: convert to ConsumerStatefulWidget with _isContacting - Fix hard cast on data['id']: use nullable parsing like matchIncomingLike - Fix error handling: use ErrorPresenter.fromDio() for typed error messages - Handle null conversationId with matchCreateFailed toast
Summary
Adds a Contact button to the flatmate profile sheet, letting users start a chat directly instead of requiring a mutual like/match first.
Problem
Viewing a flatmate's profile (from "Meet potential flatmates" or the Likes/Liked tabs) offered no way to reach out. The only existing path was to send a like and wait for a match — high friction for a simple "I'd like to talk to this person" action.
Solution
ChatsRepository— addedstartConversation(), callingPOST /flatmates/conversationsto create a conversation directly.ChatActionsController— wrappedstartConversation()with proper cache invalidation so the new conversation shows up immediately in the Chats list.FlatmateProfileSheet— added a full-width Contact button and_handleContact()flow that creates the conversation and navigates straight to it; includes a self-contact guard so the button is hidden on your own profile.SwipeProfileCard— added atrailingparameter toSwipeProfileDetailBodyso the Contact CTA can render below the profile content.Flow
Testing
Notes
POST /flatmates/conversationsendpoint.matchIncomingLike()is untouched and still handles matching from the Likes tab.Summary by cubic
Adds a Contact button to the flatmate profile sheet so users can start a chat directly without a mutual like. The conversation is created instantly, you’re taken to the new chat, and the Chats list updates right away.
New Features
Bug Fixes
Written for commit 6f3c053. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes