fix: execute BeforeDispatch only once

Issue #4557
This commit is contained in:
Michal Iskierko 2024-01-12 12:15:48 +01:00 committed by Michał Iskierko
parent ee6621b066
commit 3d7ab79d91
2 changed files with 3 additions and 2 deletions

View File

@ -241,8 +241,6 @@ func (s *MessageSender) SendGroup(
}
}
rawMessage.BeforeDispatch = nil
// Send to each recipients
for _, recipient := range recipients {
_, err = s.sendPrivate(ctx, recipient, &rawMessage)

View File

@ -2399,6 +2399,9 @@ func (m *Messenger) sendChatMessage(ctx context.Context, message *common.Message
return err
}
// ensure that the message is saved only once
rawMessage.BeforeDispatch = nil
return m.persistence.SaveMessages([]*common.Message{message})
}