fix(chat): open the conversation with the other participant
/chat/start/:id starts a chat between the caller and :id, so it takes the counterpart — the web already passes the client when a professional opens it. Mobile always sent the professional, so a professional opening the chat started a conversation with themselves. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
7930890d09
commit
29ff91a790
@@ -45,10 +45,18 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _loadChat() {
|
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(
|
chatBloc.add(LoadChatEvent(
|
||||||
serviceId: widget.service.id ?? '',
|
serviceId: widget.service.id ?? '',
|
||||||
userId: widget.service.userId,
|
userId: widget.service.userId,
|
||||||
professionalId: widget.service.professionalId,
|
professionalId: counterpartId,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user