# Conflicts: # server/channels/app/slack.go Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7526844c50
Коммит
667dffe31d
@@ -91,7 +91,7 @@ func (a *App) ProcessSlackText(text string) string {
|
||||
// documented here: https://api.slack.com/docs/attachments
|
||||
func (a *App) ProcessSlackAttachments(attachments []*model.SlackAttachment) []*model.SlackAttachment {
|
||||
var nonNilAttachments = model.StringifySlackFieldValue(attachments)
|
||||
for _, attachment := range attachments {
|
||||
for _, attachment := range nonNilAttachments {
|
||||
attachment.Pretext = a.ProcessSlackText(attachment.Pretext)
|
||||
attachment.Text = a.ProcessSlackText(attachment.Text)
|
||||
attachment.Title = a.ProcessSlackText(attachment.Title)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -125,6 +125,14 @@ func (a *App) TriggerWebhook(c request.CTX, payload *model.OutgoingWebhookPayloa
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
logger.Error("Recovered from panic in outgoing webhook goroutine",
|
||||
mlog.String("url", url),
|
||||
mlog.Any("panic", r),
|
||||
)
|
||||
}
|
||||
}()
|
||||
|
||||
var accessToken *model.OutgoingOAuthConnectionToken
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user