From e7725106ed5b435c625a63691d99acc197a2106a Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 5 Dec 2017 13:18:45 -0600 Subject: fix post editing when channel links are present (#7938) --- app/post.go | 2 +- app/post_test.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/post.go b/app/post.go index 0bd3b654f..192c2effb 100644 --- a/app/post.go +++ b/app/post.go @@ -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) diff --git a/app/post_test.go b/app/post_test.go index 3b7e8d039..82eac3cd1 100644 --- a/app/post_test.go +++ b/app/post_test.go @@ -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"]) } -- cgit v1.2.3-1-g7c22