fix mismatched message ids when client first sends a message
This bug is caused by the message being sent to all clients before msg.SetDefaults() is called and the message is saved to the chat database. This causes connected clients to get a message id that is different from what exists in the database. This only affects clients using websockets that were connected when the message was sent and message visibility updated. Fixes https://github.com/owncast/owncast/issues/809
This commit is contained in:
parent
f8d84e72fa
commit
7e0822b62d
@ -143,11 +143,13 @@ func (s *server) Listen() {
|
||||
msg.RenderAndSanitizeMessageBody()
|
||||
|
||||
if !msg.Empty() {
|
||||
// set defaults before sending msg to anywhere
|
||||
msg.SetDefaults()
|
||||
|
||||
s.listener.MessageSent(msg)
|
||||
s.sendAll(msg)
|
||||
|
||||
// Store in the message history
|
||||
msg.SetDefaults()
|
||||
if !msg.Ephemeral {
|
||||
addMessage(msg)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user