diff options
Diffstat (limited to 'app/post.go')
-rw-r--r-- | app/post.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/post.go b/app/post.go index d51ba7103..da5661ae2 100644 --- a/app/post.go +++ b/app/post.go @@ -29,6 +29,11 @@ func (a *App) CreatePostAsUser(post *model.Post) (*model.Post, *model.AppError) channel = result.Data.(*model.Channel) } + if strings.HasPrefix(post.Type, model.POST_SYSTEM_MESSAGE_PREFIX) { + err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.type"}, "", http.StatusBadRequest) + return nil, err + } + if channel.DeleteAt != 0 { err := model.NewAppError("createPost", "api.post.create_post.can_not_post_to_deleted.error", nil, "", http.StatusBadRequest) return nil, err @@ -599,12 +604,14 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr // Get the posts postList := model.NewPostList() - if presult := <-a.Srv.Store.Post().GetPostsByIds(postIds); presult.Err != nil { - return nil, presult.Err - } else { - for _, p := range presult.Data.([]*model.Post) { - postList.AddPost(p) - postList.AddOrder(p.Id) + if len(postIds) > 0 { + if presult := <-a.Srv.Store.Post().GetPostsByIds(postIds); presult.Err != nil { + return nil, presult.Err + } else { + for _, p := range presult.Data.([]*model.Post) { + postList.AddPost(p) + postList.AddOrder(p.Id) + } } } |