summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorElias Nahum <nahumhbl@gmail.com>2016-01-22 02:41:23 -0300
committerElias Nahum <nahumhbl@gmail.com>2016-01-22 02:41:23 -0300
commit4ef46db0f68ca1ef31297db465f6f93226e62132 (patch)
tree1f7f3d327b94bdd48ef885b5142bd5aafc909cfa /api/post.go
parent6fd328ddaa61cd75c24cd2d9b8fdc0f73c7ab974 (diff)
downloadchat-4ef46db0f68ca1ef31297db465f6f93226e62132.tar.gz
chat-4ef46db0f68ca1ef31297db465f6f93226e62132.tar.bz2
chat-4ef46db0f68ca1ef31297db465f6f93226e62132.zip
PLT-7: Change post CreatePost back to model.NewAppError
- It was failing test using model.NewLocAppError
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/api/post.go b/api/post.go
index fe89ebf19..a3ce99a14 100644
--- a/api/post.go
+++ b/api/post.go
@@ -75,12 +75,15 @@ func CreatePost(c *Context, post *model.Post, triggerWebhooks bool) (*model.Post
// Verify the parent/child relationships are correct
if pchan != nil {
+ // somehow tests fail here if we use the commented lines
if presult := <-pchan; presult.Err != nil {
- return nil, model.NewLocAppError("createPost", "api.post.create_post.root_id.app_error", nil, "")
+ //return nil, model.NewLocAppError("createPost", "api.post.create_post.root_id.app_error", nil, "")
+ return nil, model.NewAppError("createPost", "Invalid RootId parameter", "")
} else {
list := presult.Data.(*model.PostList)
if len(list.Posts) == 0 || !list.IsChannelId(post.ChannelId) {
- return nil, model.NewLocAppError("createPost", "api.post.create_post.channel_root_id.app_error", nil, "")
+ //return nil, model.NewLocAppError("createPost", "api.post.create_post.channel_root_id.app_error", nil, "")
+ return nil, model.NewAppError("createPost", "Invalid ChannelId for RootId parameter", "")
}
if post.ParentId == "" {
@@ -90,7 +93,8 @@ func CreatePost(c *Context, post *model.Post, triggerWebhooks bool) (*model.Post
if post.RootId != post.ParentId {
parent := list.Posts[post.ParentId]
if parent == nil {
- return nil, model.NewLocAppError("createPost", "api.post.create_post.parent_id.app_error", nil, "")
+ //return nil, model.NewLocAppError("createPost", "api.post.create_post.parent_id.app_error", nil, "")
+ return nil, model.NewAppError("createPost", "Invalid ParentId parameter", "")
}
}
}