Do not send user joined events to chat clients if stream is not active. Closes #750
This commit is contained in:
parent
b47589fa8f
commit
0bfd9f8e1f
@ -77,10 +77,11 @@ func (s *server) usernameChanged(msg models.NameChangeEvent) {
|
||||
}
|
||||
|
||||
func (s *server) userJoined(msg models.UserJoinedEvent) {
|
||||
for _, c := range s.Clients {
|
||||
c.userJoinedChannel <- msg
|
||||
if s.listener.IsStreamConnected() {
|
||||
for _, c := range s.Clients {
|
||||
c.userJoinedChannel <- msg
|
||||
}
|
||||
}
|
||||
|
||||
go webhooks.SendChatEventUserJoined(msg)
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,11 @@ func (cl ChatListenerImpl) ClientRemoved(clientID string) {
|
||||
func (cl ChatListenerImpl) MessageSent(message models.ChatEvent) {
|
||||
}
|
||||
|
||||
// IsStreamConnected will return if the stream is connected.
|
||||
func (cl ChatListenerImpl) IsStreamConnected() bool {
|
||||
return IsStreamConnected()
|
||||
}
|
||||
|
||||
// SendMessageToChat sends a message to the chat server.
|
||||
func SendMessageToChat(message models.ChatEvent) error {
|
||||
chat.SendMessage(message)
|
||||
|
@ -5,4 +5,5 @@ type ChatListener interface {
|
||||
ClientAdded(client Client)
|
||||
ClientRemoved(clientID string)
|
||||
MessageSent(message ChatEvent)
|
||||
IsStreamConnected() bool
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user