mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
fix post editing when channel links are present (#7938)
This commit is contained in:
@@ -207,7 +207,7 @@ func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.A
|
||||
if len(channelMentions) > 0 {
|
||||
if channel == nil {
|
||||
result := <-a.Srv.Store.Channel().GetForPost(post.Id)
|
||||
if result.Err == nil {
|
||||
if result.Err != nil {
|
||||
return model.NewAppError("FillInPostProps", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, result.Err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
channel = result.Data.(*model.Channel)
|
||||
|
||||
@@ -175,4 +175,13 @@ func TestPostChannelMentions(t *testing.T) {
|
||||
"display_name": "Mention Test",
|
||||
},
|
||||
}, result.Props["channel_mentions"])
|
||||
|
||||
post.Message = fmt.Sprintf("goodbye, ~%v!", channelToMention.Name)
|
||||
result, err = th.App.UpdatePost(post, false)
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, map[string]interface{}{
|
||||
"mention-test": map[string]interface{}{
|
||||
"display_name": "Mention Test",
|
||||
},
|
||||
}, result.Props["channel_mentions"])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user