Only ignore messages 5min after disconnect. Part of fixing #1268
This commit is contained in:
parent
f87d4f960a
commit
6fb383d04b
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/owncast/owncast/core/chat/events"
|
"github.com/owncast/owncast/core/chat/events"
|
||||||
"github.com/owncast/owncast/core/data"
|
"github.com/owncast/owncast/core/data"
|
||||||
@ -80,9 +81,12 @@ func (s *ChatServer) userMessageSent(eventData chatClientEvent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore if the stream in offline
|
// Ignore if the stream has been offline
|
||||||
if !getStatus().Online {
|
if !getStatus().Online && getStatus().LastDisconnectTime != nil {
|
||||||
return
|
disconnectedTime := getStatus().LastDisconnectTime.Time
|
||||||
|
if time.Since(disconnectedTime) > 5*time.Minute {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.User = user.GetUserByToken(eventData.client.accessToken)
|
event.User = user.GetUserByToken(eventData.client.accessToken)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user