PLT-7092 Fixed creation of PostList with null Posts fields (#6924)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
9a654d7b27
Коммит
4eed88e0c2
@@ -602,16 +602,15 @@ func getMyChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
func getPinnedPosts(c *Context, w http.ResponseWriter, r *http.Request) {
|
func getPinnedPosts(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
params := mux.Vars(r)
|
params := mux.Vars(r)
|
||||||
channelId := params["channel_id"]
|
channelId := params["channel_id"]
|
||||||
posts := &model.PostList{}
|
|
||||||
|
|
||||||
if result := <-app.Srv.Store.Channel().GetPinnedPosts(channelId); result.Err != nil {
|
if result := <-app.Srv.Store.Channel().GetPinnedPosts(channelId); result.Err != nil {
|
||||||
c.Err = result.Err
|
c.Err = result.Err
|
||||||
return
|
return
|
||||||
} else {
|
} 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) {
|
func addMember(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ func (s SqlChannelStore) GetPinnedPosts(channelId string) StoreChannel {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
result := StoreResult{}
|
result := StoreResult{}
|
||||||
pl := &model.PostList{}
|
pl := model.NewPostList()
|
||||||
|
|
||||||
var posts []*model.Post
|
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 {
|
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 {
|
||||||
|
|||||||
@@ -910,8 +910,7 @@ func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchP
|
|||||||
result := StoreResult{}
|
result := StoreResult{}
|
||||||
|
|
||||||
if !*utils.Cfg.ServiceSettings.EnablePostSearch {
|
if !*utils.Cfg.ServiceSettings.EnablePostSearch {
|
||||||
list := &model.PostList{}
|
list := model.NewPostList()
|
||||||
list.MakeNonNil()
|
|
||||||
result.Data = list
|
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()))
|
result.Err = model.NewLocAppError("SqlPostStore.Search", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v params=%v", teamId, userId, params.ToJson()))
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user