Skip to content

Commit 41c1dc4

Browse files
committed
minor fixes
1 parent 890732b commit 41c1dc4

File tree

1 file changed

+29
-44
lines changed

1 file changed

+29
-44
lines changed

pkg/handler/conversations.go

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package handler
33
import (
44
"context"
55
"encoding/base64"
6-
"encoding/json"
76
"errors"
87
"fmt"
98
"net/url"
@@ -46,18 +45,16 @@ type Reaction struct {
4645
}
4746

4847
type Message struct {
49-
MsgID string `json:"msgID"`
50-
ClientMsgID string `json:"clientMsgID,omitempty"`
51-
UserID string `json:"userID"`
52-
UserName string `json:"userUser"`
53-
RealName string `json:"realName"`
54-
Channel string `json:"channelID"`
55-
ThreadTs string `json:"ThreadTs"`
56-
Text string `json:"text"`
57-
Time string `json:"time"`
58-
Reactions []Reaction `json:"reactions,omitempty"`
59-
Blocks string `json:"blocks,omitempty"`
60-
Cursor string `json:"cursor"`
48+
MsgID string `json:"msgID"`
49+
UserID string `json:"userID"`
50+
UserName string `json:"userUser"`
51+
RealName string `json:"realName"`
52+
Channel string `json:"channelID"`
53+
ThreadTs string `json:"ThreadTs"`
54+
Text string `json:"text"`
55+
Time string `json:"time"`
56+
Reactions []Reaction `json:"reactions,omitempty"`
57+
Cursor string `json:"cursor"`
6158
}
6259

6360
type User struct {
@@ -410,26 +407,16 @@ func (ch *ConversationsHandler) convertMessagesFromHistory(slackMessages []slack
410407
})
411408
}
412409

413-
// Convert blocks to JSON string for CSV compatibility
414-
var blocksJSON string
415-
if len(msg.Blocks.BlockSet) > 0 {
416-
if blocksBytes, err := json.Marshal(msg.Blocks.BlockSet); err == nil {
417-
blocksJSON = string(blocksBytes)
418-
}
419-
}
420-
421410
messages = append(messages, Message{
422-
MsgID: msg.Timestamp,
423-
ClientMsgID: msg.ClientMsgID,
424-
UserID: msg.User,
425-
UserName: userName,
426-
RealName: realName,
427-
Text: text.ProcessText(msgText),
428-
Channel: channel,
429-
ThreadTs: msg.ThreadTimestamp,
430-
Time: timestamp,
431-
Reactions: reactions,
432-
Blocks: blocksJSON,
411+
MsgID: msg.Timestamp,
412+
UserID: msg.User,
413+
UserName: userName,
414+
RealName: realName,
415+
Text: text.ProcessText(msgText),
416+
Channel: channel,
417+
ThreadTs: msg.ThreadTimestamp,
418+
Time: timestamp,
419+
Reactions: reactions,
433420
})
434421
}
435422

@@ -468,20 +455,18 @@ func (ch *ConversationsHandler) convertMessagesFromSearch(slackMessages []slack.
468455

469456
msgText := msg.Text + text.AttachmentsTo2CSV(msg.Text, msg.Attachments)
470457

471-
// Note: Search messages don't typically have reactions/blocks/client_msg_id in the API response
458+
// Note: Search messages don't typically have reactions in the API response
472459
// but we include empty values for consistency with the Message struct
473460
messages = append(messages, Message{
474-
MsgID: msg.Timestamp,
475-
ClientMsgID: "", // Not available in search results
476-
UserID: msg.User,
477-
UserName: userName,
478-
RealName: realName,
479-
Text: text.ProcessText(msgText),
480-
Channel: fmt.Sprintf("#%s", msg.Channel.Name),
481-
ThreadTs: threadTs,
482-
Time: timestamp,
483-
Reactions: nil, // Not available in search results
484-
Blocks: "", // Not available in search results
461+
MsgID: msg.Timestamp,
462+
UserID: msg.User,
463+
UserName: userName,
464+
RealName: realName,
465+
Text: text.ProcessText(msgText),
466+
Channel: fmt.Sprintf("#%s", msg.Channel.Name),
467+
ThreadTs: threadTs,
468+
Time: timestamp,
469+
Reactions: nil, // Not available in search results
485470
})
486471
}
487472

0 commit comments

Comments
 (0)