parent
c8f10dcc55
commit
cfcf6469d6
@ -185,8 +185,14 @@ func (c *Chat) AddMessage(message Message) {
|
|||||||
// AddReply adds a single reply to a parent thread, it also sets
|
// AddReply adds a single reply to a parent thread, it also sets
|
||||||
// the thread separator
|
// the thread separator
|
||||||
func (c *Chat) AddReply(parentID string, message Message) {
|
func (c *Chat) AddReply(parentID string, message Message) {
|
||||||
message.Thread = " "
|
// It is possible that a message is received but the parent is not
|
||||||
c.Messages[parentID].Messages[message.ID] = message
|
// present in the chat view
|
||||||
|
if _, ok := c.Messages[parentID]; ok {
|
||||||
|
message.Thread = " "
|
||||||
|
c.Messages[parentID].Messages[message.ID] = message
|
||||||
|
} else {
|
||||||
|
c.AddMessage(message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearMessages clear the c.Messages
|
// ClearMessages clear the c.Messages
|
||||||
|
Loading…
Reference in New Issue
Block a user