[MM-16389] Add icon_emoji parameter to webhooks (#11586)
[MM-16389] Add icon_emoji field to posts from incoming webhooks To be used to substitute the profile picture on posts.
Этот коммит содержится в:
@@ -235,6 +235,49 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("emojis overriding profile icon", func(t *testing.T) {
|
||||
th := setup()
|
||||
defer th.TearDown()
|
||||
|
||||
prepare := func(override bool, url, emoji string) *model.Post {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnablePostIconOverride = override
|
||||
})
|
||||
|
||||
post, err := th.App.CreatePost(&model.Post{
|
||||
UserId: th.BasicUser.Id,
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: "Test",
|
||||
}, th.BasicChannel, false)
|
||||
|
||||
require.Nil(t, err)
|
||||
|
||||
post.AddProp(model.POST_PROPS_OVERRIDE_ICON_URL, url)
|
||||
post.AddProp(model.POST_PROPS_OVERRIDE_ICON_EMOJI, emoji)
|
||||
|
||||
return th.App.PreparePostForClient(post, false, false)
|
||||
}
|
||||
|
||||
emoji := "basketball"
|
||||
url := "http://host.com/image.png"
|
||||
overridenUrl := "/static/emoji/1f3c0.png"
|
||||
|
||||
t.Run("does not override icon URL", func(t *testing.T) {
|
||||
clientPost := prepare(false, url, emoji)
|
||||
|
||||
s, _ := clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_URL]
|
||||
assert.EqualValues(t, url, s)
|
||||
})
|
||||
|
||||
t.Run("overrides icon URL", func(t *testing.T) {
|
||||
clientPost := prepare(true, url, emoji)
|
||||
|
||||
s, _ := clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_URL]
|
||||
assert.EqualValues(t, overridenUrl, s)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
t.Run("markdown image dimensions", func(t *testing.T) {
|
||||
th := setup()
|
||||
defer th.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user