Skip to content

Commit

Permalink
feat(state): dropped last_message_id updates for threads
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Feb 17, 2022
1 parent 9321cd3 commit b1bb26d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions state.go
Expand Up @@ -801,10 +801,6 @@ func (s *State) MessageAdd(message *Message) error {
c.Messages = c.Messages[len(c.Messages)-s.MaxMessageCount:]
}

if c.IsThread() {
c.LastMessageID = message.ID
}

return nil
}

Expand All @@ -829,12 +825,8 @@ func (s *State) messageRemoveByID(channelID, messageID string) error {

for i, m := range c.Messages {
if m.ID == messageID {
if c.IsThread() {
if i == len(c.Messages)-1 && len(c.Messages) > 0 {
c.LastMessageID = c.Messages[i-1].ID
}
}
c.Messages = append(c.Messages[:i], c.Messages[i+1:]...)

return nil
}
}
Expand Down

0 comments on commit b1bb26d

Please sign in to comment.