forked from mtusi2026/mtusi2026lab4
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
771882427c | ||
|
|
4cec8f1c5a | ||
|
|
6a29caf911 | ||
|
|
efaeb593e8 |
@@ -26,9 +26,6 @@ func (s *Store) CreateMessage(
|
||||
idempotencyKey string,
|
||||
idempotencyTTL time.Duration,
|
||||
) (model.Message, bool, error) {
|
||||
if attachmentIDs == nil {
|
||||
attachmentIDs = []string{}
|
||||
}
|
||||
var (
|
||||
tx pgx.Tx
|
||||
err error
|
||||
@@ -304,8 +301,7 @@ func insertMessage(
|
||||
if err := insertMessageAttachments(ctx, tx, messageID, chatID, attachmentIDs); err != nil {
|
||||
return model.Message{}, err
|
||||
}
|
||||
message.AttachmentIDs = make([]string, len(attachmentIDs))
|
||||
copy(message.AttachmentIDs, attachmentIDs)
|
||||
message.AttachmentIDs = append([]string(nil), attachmentIDs...)
|
||||
return message, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user