summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"])
}