Improved processing of attachments (#35854) (#36103)

# Conflicts:
#	server/channels/app/slack.go

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Andre Vasconcelos
2026-04-15 17:32:34 +03:00
коммит произвёл GitHub
родитель 7526844c50
Коммит 667dffe31d
3 изменённых файлов: 36 добавлений и 1 удалений

Просмотреть файл

@@ -6,6 +6,8 @@ package app
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost/server/public/model"
)
@@ -33,6 +35,31 @@ func TestProcessSlackText(t *testing.T) {
}
}
func TestProcessMessageAttachmentsWithNilEntries(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
attachments := []*model.SlackAttachment{
nil,
{
Pretext: "pretext",
Text: "text",
Title: "title",
},
nil,
{
Pretext: "pretext2",
Text: "text2",
},
}
result := th.App.ProcessSlackAttachments(attachments)
require.Len(t, result, 2)
require.Equal(t, "pretext", result[0].Pretext)
require.Equal(t, "pretext2", result[1].Pretext)
}
func TestProcessSlackAnnouncement(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()