fix: include attachment TitleLink in message text output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tim-watcha
2026-04-14 14:19:43 +09:00
committed by Dmitrii Korotovskii
parent d9213df8f9
commit d3f7ca3a4a
2 changed files with 20 additions and 1 deletions
+5 -1
View File
@@ -18,7 +18,11 @@ func AttachmentToText(att slack.Attachment) string {
var parts []string
if att.Title != "" {
parts = append(parts, fmt.Sprintf("Title: %s", att.Title))
if att.TitleLink != "" {
parts = append(parts, fmt.Sprintf("Title: [%s](%s)", att.Title, att.TitleLink))
} else {
parts = append(parts, fmt.Sprintf("Title: %s", att.Title))
}
}
if att.AuthorName != "" {
+15
View File
@@ -400,6 +400,21 @@ func TestAttachmentToText(t *testing.T) {
},
want: "",
},
{
name: "title_with_link",
att: slack.Attachment{
Title: "Error details",
TitleLink: "https://sentry.io/issues/123",
},
want: "Title: [Error details][https://sentry.io/issues/123]",
},
{
name: "title_without_link",
att: slack.Attachment{
Title: "Plain title",
},
want: "Title: Plain title",
},
}
for _, tt := range tests {