diff --git a/app/post.go b/app/post.go index b9e29456ed..86ec8a1855 100644 --- a/app/post.go +++ b/app/post.go @@ -375,8 +375,13 @@ func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.A for _, mentioned := range mentionedChannels { if mentioned.Type == model.CHANNEL_OPEN { + team, err := a.Srv().Store.Team().Get(mentioned.TeamId) + if err != nil { + mlog.Error("Failed to get team of the channel mention", mlog.String("team_id", channel.TeamId), mlog.String("channel_id", channel.Id), mlog.Err(err)) + } channelMentionsProp[mentioned.Name] = map[string]interface{}{ "display_name": mentioned.DisplayName, + "team_name": team.Name, } } } diff --git a/app/post_test.go b/app/post_test.go index 1760679621..7b8e606d55 100644 --- a/app/post_test.go +++ b/app/post_test.go @@ -432,6 +432,7 @@ func TestPostChannelMentions(t *testing.T) { assert.Equal(t, map[string]interface{}{ "mention-test": map[string]interface{}{ "display_name": "Mention Test", + "team_name": th.BasicTeam.Name, }, }, result.GetProp("channel_mentions")) @@ -441,6 +442,7 @@ func TestPostChannelMentions(t *testing.T) { assert.Equal(t, map[string]interface{}{ "mention-test": map[string]interface{}{ "display_name": "Mention Test", + "team_name": th.BasicTeam.Name, }, }, result.GetProp("channel_mentions")) }