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

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

@@ -623,7 +623,7 @@ func TestExportPostWithProps(t *testing.T) {
ChannelId: dmChannel.Id,
Message: "aa" + model.NewId() + "a",
Props: map[string]any{
"attachments": attachments,
model.PostPropsAttachments: attachments,
},
UserId: th1.BasicUser.Id,
}
@@ -634,7 +634,7 @@ func TestExportPostWithProps(t *testing.T) {
ChannelId: gmChannel.Id,
Message: "dd" + model.NewId() + "a",
Props: map[string]any{
"attachments": attachments,
model.PostPropsAttachments: attachments,
},
UserId: th1.BasicUser.Id,
}
@@ -673,8 +673,8 @@ func TestExportPostWithProps(t *testing.T) {
assert.Len(t, posts, 2)
assert.ElementsMatch(t, gmMembers, *posts[0].ChannelMembers)
assert.ElementsMatch(t, dmMembers, *posts[1].ChannelMembers)
assert.Contains(t, posts[0].Props["attachments"].([]any)[0], "footer")
assert.Contains(t, posts[1].Props["attachments"].([]any)[0], "footer")
assert.Contains(t, posts[0].Props[model.PostPropsAttachments].([]any)[0], "footer")
assert.Contains(t, posts[1].Props[model.PostPropsAttachments].([]any)[0], "footer")
}
func TestExportUserCustomStatus(t *testing.T) {