[MM-35316] Fix panic in app.CreateSidebarCategory (#17546)
* Fix returned error * Fix expected error
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e414efac63
Коммит
a7e6eef836
@@ -248,10 +248,8 @@ func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategor
|
||||
categoriesWithOrder, err := s.getSidebarCategoriesT(transaction, userId, teamId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(categoriesWithOrder.Categories) < 1 {
|
||||
return nil, errors.Wrap(err, "categories not found")
|
||||
} else if len(categoriesWithOrder.Categories) == 0 {
|
||||
return nil, store.NewErrNotFound("categories not found", fmt.Sprintf("userId=%s,teamId=%s", userId, teamId))
|
||||
}
|
||||
|
||||
newOrder := categoriesWithOrder.Order
|
||||
@@ -480,6 +478,7 @@ func (s SqlChannelStore) getSidebarCategoriesT(db dbSelecter, userId, teamId str
|
||||
if _, err = db.Select(&categories, query, args...); err != nil {
|
||||
return nil, store.NewErrNotFound("SidebarCategories", fmt.Sprintf("userId=%s,teamId=%s", userId, teamId))
|
||||
}
|
||||
|
||||
for _, category := range categories {
|
||||
var prevCategory *model.SidebarCategoryWithChannels
|
||||
for _, existing := range oc.Categories {
|
||||
|
||||
Ссылка в новой задаче
Block a user