[MM-62427] Add message attachments validation (#30180)

* Add message attachments validation

* Add props validation

* Validate slack attachment fields

* Update tests and library usage

* Improve interactive dialog error for length checks

* Allow predefined colors for slack attachments

* Fix TestPostAction

* Use const for data source

* Add tests

* Cleanup unused props

* Add happy path tests

* lint fixes

* Add validation for PostActionOptions
Этот коммит содержится в:
Ben Schumacher
2025-03-20 12:53:50 +01:00
коммит произвёл GitHub
родитель 5609489e86
Коммит 9b5d8d52bf
47 изменённых файлов: 1402 добавлений и 355 удалений

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

@@ -618,28 +618,28 @@ func (a *App) HandleCommandResponsePost(c request.CTX, command *model.Command, a
if *a.Config().ServiceSettings.EnablePostUsernameOverride {
if command.Username != "" {
post.AddProp("override_username", command.Username)
post.AddProp(model.PostPropsOverrideUsername, command.Username)
isBotPost = true
} else if response.Username != "" {
post.AddProp("override_username", response.Username)
post.AddProp(model.PostPropsOverrideUsername, response.Username)
isBotPost = true
}
}
if *a.Config().ServiceSettings.EnablePostIconOverride {
if command.IconURL != "" {
post.AddProp("override_icon_url", command.IconURL)
post.AddProp(model.PostPropsOverrideIconURL, command.IconURL)
isBotPost = true
} else if response.IconURL != "" {
post.AddProp("override_icon_url", response.IconURL)
post.AddProp(model.PostPropsOverrideIconURL, response.IconURL)
isBotPost = true
} else {
post.AddProp("override_icon_url", "")
post.AddProp(model.PostPropsOverrideIconURL, "")
}
}
if isBotPost {
post.AddProp("from_webhook", "true")
post.AddProp(model.PostPropsFromWebhook, "true")
}
// Process Slack text replacements if the response does not contain "skip_slack_parsing": true.