MM-12036 Add image dimensions for other fields in message attachments (#9748)
Этот коммит содержится в:
@@ -248,6 +248,22 @@ func getImagesInMessageAttachments(post *model.Post) []string {
|
||||
images = append(images, imagesInFieldValue...)
|
||||
}
|
||||
}
|
||||
|
||||
if attachment.AuthorIcon != "" {
|
||||
images = append(images, attachment.AuthorIcon)
|
||||
}
|
||||
|
||||
if attachment.ImageURL != "" {
|
||||
images = append(images, attachment.ImageURL)
|
||||
}
|
||||
|
||||
if attachment.ThumbURL != "" {
|
||||
images = append(images, attachment.ThumbURL)
|
||||
}
|
||||
|
||||
if attachment.FooterIcon != "" {
|
||||
images = append(images, attachment.FooterIcon)
|
||||
}
|
||||
}
|
||||
|
||||
return images
|
||||
|
||||
@@ -692,6 +692,58 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
|
||||
},
|
||||
Expected: []string{"https://example.com/logo2", "https://example.com/icon2"},
|
||||
},
|
||||
{
|
||||
Name: "image in author_icon",
|
||||
Post: &model.Post{
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
{
|
||||
AuthorIcon: "https://example.com/icon2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Expected: []string{"https://example.com/icon2"},
|
||||
},
|
||||
{
|
||||
Name: "image in image_url",
|
||||
Post: &model.Post{
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
{
|
||||
ImageURL: "https://example.com/image",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Expected: []string{"https://example.com/image"},
|
||||
},
|
||||
{
|
||||
Name: "image in thumb_url",
|
||||
Post: &model.Post{
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
{
|
||||
ThumbURL: "https://example.com/image",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Expected: []string{"https://example.com/image"},
|
||||
},
|
||||
{
|
||||
Name: "image in footer_icon",
|
||||
Post: &model.Post{
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
{
|
||||
FooterIcon: "https://example.com/image",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Expected: []string{"https://example.com/image"},
|
||||
},
|
||||
{
|
||||
Name: "images in multiple fields",
|
||||
Post: &model.Post{
|
||||
|
||||
Ссылка в новой задаче
Block a user