summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/channel.go5
-rw-r--r--store/sql_channel_store.go2
-rw-r--r--store/sql_post_store.go3
3 files changed, 4 insertions, 6 deletions
diff --git a/api/channel.go b/api/channel.go
index c7b0630e6..2a56e7c93 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -602,16 +602,15 @@ func getMyChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) {
func getPinnedPosts(c *Context, w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
channelId := params["channel_id"]
- posts := &model.PostList{}
if result := <-app.Srv.Store.Channel().GetPinnedPosts(channelId); result.Err != nil {
c.Err = result.Err
return
} else {
- posts = result.Data.(*model.PostList)
+ posts := result.Data.(*model.PostList)
+ w.Write([]byte(posts.ToJson()))
}
- w.Write([]byte(posts.ToJson()))
}
func addMember(c *Context, w http.ResponseWriter, r *http.Request) {
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index c009d64d3..db9c2c1f4 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -361,7 +361,7 @@ func (s SqlChannelStore) GetPinnedPosts(channelId string) StoreChannel {
go func() {
result := StoreResult{}
- pl := &model.PostList{}
+ pl := model.NewPostList()
var posts []*model.Post
if _, err := s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE IsPinned = true AND ChannelId = :ChannelId AND DeleteAt = 0 ORDER BY CreateAt ASC", map[string]interface{}{"ChannelId": channelId}); err != nil {
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index 16142681c..e89b5e042 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -910,8 +910,7 @@ func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchP
result := StoreResult{}
if !*utils.Cfg.ServiceSettings.EnablePostSearch {
- list := &model.PostList{}
- list.MakeNonNil()
+ list := model.NewPostList()
result.Data = list
result.Err = model.NewLocAppError("SqlPostStore.Search", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v params=%v", teamId, userId, params.ToJson()))