summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-12-05 13:18:45 -0600
committerHarrison Healey <harrisonmhealey@gmail.com>2017-12-05 14:18:45 -0500
commite7725106ed5b435c625a63691d99acc197a2106a (patch)
treeb03305e9a653cda659b180281ca25cc9dbc274d5 /app
parent36777057f2b92bd3c0a222f2266eef2cc52f57d7 (diff)
downloadchat-e7725106ed5b435c625a63691d99acc197a2106a.tar.gz
chat-e7725106ed5b435c625a63691d99acc197a2106a.tar.bz2
chat-e7725106ed5b435c625a63691d99acc197a2106a.zip
fix post editing when channel links are present (#7938)
Diffstat (limited to 'app')
-rw-r--r--app/post.go2
-rw-r--r--app/post_test.go9
2 files changed, 10 insertions, 1 deletions
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"])
}