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:
@@ -31,7 +31,9 @@ func (h *captureHub) SendToRoom(room string, data []byte) {
|
||||
func TestBridgeListenerRoutesWebWidgetEventsToDashboardAndVisitor(t *testing.T) {
|
||||
event := channel.NewChannelEvent(channel.EventMessageCreated, channel.ChannelWebWidget, 1, 4)
|
||||
event.Data["widget_token"] = "visitor-token"
|
||||
displayID := uint(42)
|
||||
event.Data["message"] = &model.Message{Base: model.Base{ID: 12}, AccountID: 1, InboxID: 4, ConversationID: 2, MessageType: "outgoing", SenderType: "User"}
|
||||
event.Data["conversation"] = &model.Conversation{Base: model.Base{ID: 2}, DisplayID: &displayID}
|
||||
event.Data["sender"] = &model.User{Base: model.Base{ID: 8}, Name: "Agent A"}
|
||||
|
||||
hub := &captureHub{}
|
||||
@@ -53,6 +55,9 @@ func TestBridgeListenerRoutesWebWidgetEventsToDashboardAndVisitor(t *testing.T)
|
||||
if payload["sender_type"] != "User" || payload["sender"].(map[string]interface{})["name"] != "Agent A" {
|
||||
t.Fatalf("visitor reply sender contract mismatch: %#v", payload)
|
||||
}
|
||||
if payload["message_type"] != float64(1) || payload["conversation_id"] != float64(displayID) {
|
||||
t.Fatalf("visitor reply message contract mismatch: %#v", payload)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBridgeListenerPreservesWebWidgetSenderTypeContract(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user