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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user