fix: edit message even if converting link previews to proto
This commit is contained in:
parent
b5c82adb70
commit
eab6118f12
|
@ -2309,9 +2309,10 @@ func (m *Messenger) sendChatMessage(ctx context.Context, message *common.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unfurledLinks, err := message.ConvertLinkPreviewsToProto()
|
|
||||||
// We consider link previews non-critical data, so we do not want to block
|
// We consider link previews non-critical data, so we do not want to block
|
||||||
// messages from being sent.
|
// messages from being sent.
|
||||||
|
|
||||||
|
unfurledLinks, err := message.ConvertLinkPreviewsToProto()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.logger.Error("failed to convert link previews", zap.Error(err))
|
m.logger.Error("failed to convert link previews", zap.Error(err))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -69,17 +69,22 @@ func (m *Messenger) EditMessage(ctx context.Context, request *requests.EditMessa
|
||||||
editMessage.MessageId = message.ID
|
editMessage.MessageId = message.ID
|
||||||
editMessage.Clock = clock
|
editMessage.Clock = clock
|
||||||
|
|
||||||
|
// We consider link previews non-critical data, so we do not want to block
|
||||||
|
// messages from being sent.
|
||||||
|
|
||||||
unfurledLinks, err := message.ConvertLinkPreviewsToProto()
|
unfurledLinks, err := message.ConvertLinkPreviewsToProto()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
m.logger.Error("failed to convert link previews", zap.Error(err))
|
||||||
|
} else {
|
||||||
|
editMessage.UnfurledLinks = unfurledLinks
|
||||||
}
|
}
|
||||||
editMessage.UnfurledLinks = unfurledLinks
|
|
||||||
|
|
||||||
unfurledStatusLinks, err := message.ConvertStatusLinkPreviewsToProto()
|
unfurledStatusLinks, err := message.ConvertStatusLinkPreviewsToProto()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
m.logger.Error("failed to convert status link previews", zap.Error(err))
|
||||||
|
} else {
|
||||||
|
editMessage.UnfurledStatusLinks = unfurledStatusLinks
|
||||||
}
|
}
|
||||||
editMessage.UnfurledStatusLinks = unfurledStatusLinks
|
|
||||||
|
|
||||||
err = m.applyEditMessage(editMessage.EditMessage, message)
|
err = m.applyEditMessage(editMessage.EditMessage, message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue