diff --git a/lib/screens/chat/chat_screen.dart b/lib/screens/chat/chat_screen.dart index 3f35608..53749cf 100644 --- a/lib/screens/chat/chat_screen.dart +++ b/lib/screens/chat/chat_screen.dart @@ -45,10 +45,18 @@ class _ChatScreenState extends State { } void _loadChat() { + // /chat/start/:id opens the conversation between the caller and :id, so it + // takes the *other* participant. Always sending the professional meant a + // professional opening the chat started a conversation with themselves. + final me = ApiUserRepository.currentUserId ?? ''; + final counterpartId = me == widget.service.professionalId + ? widget.service.userId + : widget.service.professionalId; + chatBloc.add(LoadChatEvent( serviceId: widget.service.id ?? '', userId: widget.service.userId, - professionalId: widget.service.professionalId, + professionalId: counterpartId, )); }