diff options
author | George Goldberg <george@gberg.me> | 2017-09-01 16:42:02 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-09-01 11:42:02 -0400 |
commit | e85b5fb98835fb952eb2ed55f81e79eb3ef361ec (patch) | |
tree | abe78804cd5e1175954f74b811a6d6a7af089d0b /app/post.go | |
parent | d9ec7d9240a508571904c22458222e2846c2b5b4 (diff) | |
download | chat-e85b5fb98835fb952eb2ed55f81e79eb3ef361ec.tar.gz chat-e85b5fb98835fb952eb2ed55f81e79eb3ef361ec.tar.bz2 chat-e85b5fb98835fb952eb2ed55f81e79eb3ef361ec.zip |
App: NewLocAppError -> NewAppError (#7327)
* App: NewLocAppError -> NewAppError
* Remove statuscode that got missed.
Diffstat (limited to 'app/post.go')
-rw-r--r-- | app/post.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/app/post.go b/app/post.go index 3845e1006..6e97ca680 100644 --- a/app/post.go +++ b/app/post.go @@ -24,16 +24,14 @@ func CreatePostAsUser(post *model.Post) (*model.Post, *model.AppError) { // Check that channel has not been deleted var channel *model.Channel if result := <-Srv.Store.Channel().Get(post.ChannelId, true); result.Err != nil { - err := model.NewLocAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, result.Err.Error()) - err.StatusCode = http.StatusBadRequest + err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, result.Err.Error(), http.StatusBadRequest) return nil, err } else { channel = result.Data.(*model.Channel) } if channel.DeleteAt != 0 { - err := model.NewLocAppError("createPost", "api.post.create_post.can_not_post_to_deleted.error", nil, "") - err.StatusCode = http.StatusBadRequest + err := model.NewAppError("createPost", "api.post.create_post.can_not_post_to_deleted.error", nil, "", http.StatusBadRequest) return nil, err } @@ -124,11 +122,11 @@ func CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) var parentPostList *model.PostList if pchan != nil { if presult := <-pchan; presult.Err != nil { - return nil, model.NewLocAppError("createPost", "api.post.create_post.root_id.app_error", nil, "") + return nil, model.NewAppError("createPost", "api.post.create_post.root_id.app_error", nil, "", http.StatusBadRequest) } else { parentPostList = presult.Data.(*model.PostList) if len(parentPostList.Posts) == 0 || !parentPostList.IsChannelId(post.ChannelId) { - return nil, model.NewLocAppError("createPost", "api.post.create_post.channel_root_id.app_error", nil, "") + return nil, model.NewAppError("createPost", "api.post.create_post.channel_root_id.app_error", nil, "", http.StatusInternalServerError) } if post.ParentId == "" { @@ -138,7 +136,7 @@ func CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) if post.RootId != post.ParentId { parent := parentPostList.Posts[post.ParentId] if parent == nil { - return nil, model.NewLocAppError("createPost", "api.post.create_post.parent_id.app_error", nil, "") + return nil, model.NewAppError("createPost", "api.post.create_post.parent_id.app_error", nil, "", http.StatusInternalServerError) } } } @@ -442,7 +440,7 @@ func GetPermalinkPost(postId string, userId string) (*model.PostList, *model.App list := result.Data.(*model.PostList) if len(list.Order) != 1 { - return nil, model.NewLocAppError("getPermalinkTmp", "api.post_get_post_by_id.get.app_error", nil, "") + return nil, model.NewAppError("getPermalinkTmp", "api.post_get_post_by_id.get.app_error", nil, "", http.StatusNotFound) } post := list.Posts[list.Order[0]] |