summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorChristopher Brown <ccbrown112@gmail.com>2017-10-16 23:10:45 -0500
committerChristopher Brown <ccbrown112@gmail.com>2017-10-16 23:10:45 -0500
commit39cc2372695836fdc96059d8b94992b1416f98e1 (patch)
tree56d2beb5420cd0054194f71e53c6a95578beff9a /app/post.go
parent89dc3cb126ba46b486997c433adfdf34982fcc81 (diff)
parent8bf47c1211d09079fd9407555026b7b29383ac37 (diff)
downloadchat-39cc2372695836fdc96059d8b94992b1416f98e1.tar.gz
chat-39cc2372695836fdc96059d8b94992b1416f98e1.tar.bz2
chat-39cc2372695836fdc96059d8b94992b1416f98e1.zip
Merge branch 'release-4.3'
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go19
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)
+ }
}
}