fix(slack): use full chatID as pendingAcks key in sendWithAttachments

This commit is contained in:
XZB-1248 2026-02-19 22:30:29 +08:00
parent cd842e265e
commit 3f26a37e32

View file

@ -121,7 +121,7 @@ func (c *SlackChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
// If there are attachments, send them // If there are attachments, send them
if len(msg.Attachments) > 0 { if len(msg.Attachments) > 0 {
return c.sendWithAttachments(ctx, channelID, threadTS, msg.Content, msg.Attachments) return c.sendWithAttachments(ctx, msg.ChatID, channelID, threadTS, msg.Content, msg.Attachments)
} }
opts := []slack.MsgOption{ opts := []slack.MsgOption{
@ -153,7 +153,7 @@ func (c *SlackChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
return nil return nil
} }
func (c *SlackChannel) sendWithAttachments(ctx context.Context, channelID, threadTS, content string, attachments []bus.Attachment) error { func (c *SlackChannel) sendWithAttachments(ctx context.Context, chatID, channelID, threadTS, content string, attachments []bus.Attachment) error {
for _, attachment := range attachments { for _, attachment := range attachments {
uploadErr := func() error { uploadErr := func() error {
file, err := os.Open(attachment.Path) file, err := os.Open(attachment.Path)
@ -183,7 +183,7 @@ func (c *SlackChannel) sendWithAttachments(ctx context.Context, channelID, threa
content = "" content = ""
} }
if ref, ok := c.pendingAcks.LoadAndDelete(channelID); ok { if ref, ok := c.pendingAcks.LoadAndDelete(chatID); ok {
msgRef := ref.(slackMessageRef) msgRef := ref.(slackMessageRef)
c.api.AddReaction("white_check_mark", slack.ItemRef{ c.api.AddReaction("white_check_mark", slack.ItemRef{
Channel: msgRef.ChannelID, Channel: msgRef.ChannelID,