Skip to content

Commit 1b8b1cd

Browse files
authored
Merge pull request #2630 from traPtitech/fix/roomStatesEventHandler
fix: update room state handling to use roomStates for consistency
2 parents ceba717 + 6acafd9 commit 1b8b1cd

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

service/notification/handlers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/traPtitech/traQ/model"
1616
"github.com/traPtitech/traQ/repository"
1717
"github.com/traPtitech/traQ/service/fcm"
18+
"github.com/traPtitech/traQ/service/qall"
1819
"github.com/traPtitech/traQ/service/viewer"
1920
"github.com/traPtitech/traQ/service/ws"
2021
"github.com/traPtitech/traQ/utils/message"
@@ -612,8 +613,7 @@ func qallRoomStateChangedHandler(ns *Service, ev hub.Message) {
612613
broadcast(ns,
613614
"QALL_ROOM_STATE_CHANGED",
614615
map[string]interface{}{
615-
"room_id": ev.Fields["room_id"].(uuid.UUID),
616-
"state": ev.Fields["state"],
616+
"roomStates": ev.Fields["roomStates"].(qall.RoomWithParticipants),
617617
},
618618
)
619619
}

service/qall/roomstate_impl.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (r *Repository) AddParticipantToRoomState(room *livekit.Room, participant *
5151
r.Hub.Publish(hub.Message{
5252
Name: event.QallRoomStateChanged,
5353
Fields: hub.Fields{
54-
"roomState": r.RoomState,
54+
"roomStates": r.RoomState,
5555
},
5656
})
5757
}
@@ -73,7 +73,7 @@ func (r *Repository) UpdateParticipantCanPublish(roomID string, participantID st
7373
r.Hub.Publish(hub.Message{
7474
Name: event.QallRoomStateChanged,
7575
Fields: hub.Fields{
76-
"roomState": r.RoomState,
76+
"roomStates": r.RoomState,
7777
},
7878
})
7979
}
@@ -105,7 +105,7 @@ func (r *Repository) UpdateParticipant(roomID string, participant *livekit.Parti
105105
r.Hub.Publish(hub.Message{
106106
Name: event.QallRoomStateChanged,
107107
Fields: hub.Fields{
108-
"roomState": r.RoomState,
108+
"roomStates": r.RoomState,
109109
},
110110
})
111111
}
@@ -130,7 +130,7 @@ func (r *Repository) RemoveParticipant(roomID string, participantID string) {
130130
r.Hub.Publish(hub.Message{
131131
Name: event.QallRoomStateChanged,
132132
Fields: hub.Fields{
133-
"roomState": r.RoomState,
133+
"roomStates": r.RoomState,
134134
},
135135
})
136136
}
@@ -161,7 +161,7 @@ func (r *Repository) AddRoomState(room RoomWithParticipants) {
161161
r.Hub.Publish(hub.Message{
162162
Name: event.QallRoomStateChanged,
163163
Fields: hub.Fields{
164-
"roomState": r.RoomState,
164+
"roomStates": r.RoomState,
165165
},
166166
})
167167
}
@@ -177,7 +177,7 @@ func (r *Repository) UpdateRoomMetadata(roomID string, metadata Metadata) {
177177
r.Hub.Publish(hub.Message{
178178
Name: event.QallRoomStateChanged,
179179
Fields: hub.Fields{
180-
"roomState": r.RoomState,
180+
"roomStates": r.RoomState,
181181
},
182182
})
183183
}
@@ -197,7 +197,7 @@ func (r *Repository) RemoveRoomState(roomID string) {
197197
r.Hub.Publish(hub.Message{
198198
Name: event.QallRoomStateChanged,
199199
Fields: hub.Fields{
200-
"roomState": r.RoomState,
200+
"roomStates": r.RoomState,
201201
},
202202
})
203203
}

0 commit comments

Comments
 (0)