[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 удалений

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

@@ -660,7 +660,7 @@ func TestShouldProcessMessage(t *testing.T) {
client := pluginapi.NewClient(api, &plugintest.Driver{})
shouldProcessMessage, err := client.Post.ShouldProcessMessage(
&model.Post{ChannelId: channelID, Props: model.StringInterface{"from_webhook": "true"}},
&model.Post{ChannelId: channelID, Props: model.StringInterface{model.PostPropsFromWebhook: "true"}},
pluginapi.AllowBots(),
)
@@ -677,7 +677,7 @@ func TestShouldProcessMessage(t *testing.T) {
client := pluginapi.NewClient(api, &plugintest.Driver{})
shouldProcessMessage, err := client.Post.ShouldProcessMessage(
&model.Post{ChannelId: channelID, Props: model.StringInterface{"from_webhook": "true"}},
&model.Post{ChannelId: channelID, Props: model.StringInterface{model.PostPropsFromWebhook: "true"}},
pluginapi.AllowBots(),
pluginapi.AllowWebhook(),
)
@@ -712,7 +712,7 @@ func TestShouldProcessMessage(t *testing.T) {
client := pluginapi.NewClient(api, &plugintest.Driver{})
shouldProcessMessage, err := client.Post.ShouldProcessMessage(
&model.Post{ChannelId: channelID, Props: model.StringInterface{"from_webhook": "false"}},
&model.Post{ChannelId: channelID, Props: model.StringInterface{model.PostPropsFromWebhook: "false"}},
pluginapi.AllowBots(),
)