H-337: restore Web widget reply visibility (#64)

* H-337: restore widget reply delivery

* H-337: harden widget conversation ownership

---------

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-20 22:22:27 +08:00
committed by GitHub
co-authored by rogee
parent abb1bed424
commit b31b1b9562
22 changed files with 847 additions and 83 deletions
+9 -10
View File
@@ -180,21 +180,20 @@ func (h *Hub) Register(c *Client) {
h.clients[c.ID] = c
// Auto-subscribe to account room on connect
roomName := accountRoomName(c.AccountID)
h.subscribeClient(c.ID, roomName)
c.SubscribedRooms[roomName] = true
if c.IsContact && c.PubsubToken != "" {
tokenRoom := pubsubTokenRoomName(c.PubsubToken)
h.subscribeClient(c.ID, tokenRoom)
c.SubscribedRooms[tokenRoom] = true
} else if !c.IsContact {
roomName := accountRoomName(c.AccountID)
h.subscribeClient(c.ID, roomName)
c.SubscribedRooms[roomName] = true
}
// Set up presence tracking
if h.presenceMgr != nil {
if c.IsContact {
h.presenceMgr.OnContactConnect(context.Background(), c.ContactID, c.AccountID)
// Also auto-subscribe to pubsub_token room (Chatwoot RoomChannel pattern)
if c.PubsubToken != "" {
tokenRoom := pubsubTokenRoomName(c.PubsubToken)
h.subscribeClient(c.ID, tokenRoom)
c.SubscribedRooms[tokenRoom] = true
}
} else {
cancelFn := h.presenceMgr.OnAgentConnect(context.Background(), c.UserID, c.AccountID)
c.CancelPresence = cancelFn