Adding team_name to post props for channel mentions (#14150)
* Adding team_name to post props for channel mentions * Fixing tests Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ab338e8417
Коммит
07c1e76b02
@@ -375,8 +375,13 @@ func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.A
|
|||||||
|
|
||||||
for _, mentioned := range mentionedChannels {
|
for _, mentioned := range mentionedChannels {
|
||||||
if mentioned.Type == model.CHANNEL_OPEN {
|
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{}{
|
channelMentionsProp[mentioned.Name] = map[string]interface{}{
|
||||||
"display_name": mentioned.DisplayName,
|
"display_name": mentioned.DisplayName,
|
||||||
|
"team_name": team.Name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,6 +432,7 @@ func TestPostChannelMentions(t *testing.T) {
|
|||||||
assert.Equal(t, map[string]interface{}{
|
assert.Equal(t, map[string]interface{}{
|
||||||
"mention-test": map[string]interface{}{
|
"mention-test": map[string]interface{}{
|
||||||
"display_name": "Mention Test",
|
"display_name": "Mention Test",
|
||||||
|
"team_name": th.BasicTeam.Name,
|
||||||
},
|
},
|
||||||
}, result.GetProp("channel_mentions"))
|
}, result.GetProp("channel_mentions"))
|
||||||
|
|
||||||
@@ -441,6 +442,7 @@ func TestPostChannelMentions(t *testing.T) {
|
|||||||
assert.Equal(t, map[string]interface{}{
|
assert.Equal(t, map[string]interface{}{
|
||||||
"mention-test": map[string]interface{}{
|
"mention-test": map[string]interface{}{
|
||||||
"display_name": "Mention Test",
|
"display_name": "Mention Test",
|
||||||
|
"team_name": th.BasicTeam.Name,
|
||||||
},
|
},
|
||||||
}, result.GetProp("channel_mentions"))
|
}, result.GetProp("channel_mentions"))
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user