Fix getting labels, lists or teams if none are available
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
1635beda56
commit
cfb15a27f0
|
@ -208,6 +208,10 @@ func getLabelsByTaskIDs(s *xorm.Session, opts *LabelByTaskIDsOptions) (ls []*lab
|
||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(labels) == 0 {
|
||||||
|
return nil, 0, 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Get all created by users
|
// Get all created by users
|
||||||
var userids []int64
|
var userids []int64
|
||||||
for _, l := range labels {
|
for _, l := range labels {
|
||||||
|
|
|
@ -389,6 +389,10 @@ func getRawListsForUser(s *xorm.Session, opts *listOptions) (lists []*List, resu
|
||||||
|
|
||||||
// addListDetails adds owner user objects and list tasks to all lists in the slice
|
// addListDetails adds owner user objects and list tasks to all lists in the slice
|
||||||
func addListDetails(s *xorm.Session, lists []*List) (err error) {
|
func addListDetails(s *xorm.Session, lists []*List) (err error) {
|
||||||
|
if len(lists) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var ownerIDs []int64
|
var ownerIDs []int64
|
||||||
for _, l := range lists {
|
for _, l := range lists {
|
||||||
ownerIDs = append(ownerIDs, l.OwnerID)
|
ownerIDs = append(ownerIDs, l.OwnerID)
|
||||||
|
@ -412,6 +416,10 @@ func addListDetails(s *xorm.Session, lists []*List) (err error) {
|
||||||
fileIDs = append(fileIDs, l.BackgroundFileID)
|
fileIDs = append(fileIDs, l.BackgroundFileID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(fileIDs) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Unsplash background file info
|
// Unsplash background file info
|
||||||
us := []*UnsplashPhoto{}
|
us := []*UnsplashPhoto{}
|
||||||
err = s.In("file_id", fileIDs).Find(&us)
|
err = s.In("file_id", fileIDs).Find(&us)
|
||||||
|
|
|
@ -531,6 +531,14 @@ func (n *Namespace) Delete(s *xorm.Session, a web.Auth) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(lists) == 0 {
|
||||||
|
return events.Dispatch(&NamespaceDeletedEvent{
|
||||||
|
Namespace: n,
|
||||||
|
Doer: a,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var listIDs []int64
|
var listIDs []int64
|
||||||
// We need to do that for here because we need the list ids to delete two times:
|
// We need to do that for here because we need the list ids to delete two times:
|
||||||
// 1) to delete the lists itself
|
// 1) to delete the lists itself
|
||||||
|
|
|
@ -120,6 +120,11 @@ func GetTeamByID(s *xorm.Session, id int64) (team *Team, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func addMoreInfoToTeams(s *xorm.Session, teams []*Team) (err error) {
|
func addMoreInfoToTeams(s *xorm.Session, teams []*Team) (err error) {
|
||||||
|
|
||||||
|
if len(teams) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Put the teams in a map to make assigning more info to it more efficient
|
// Put the teams in a map to make assigning more info to it more efficient
|
||||||
teamMap := make(map[int64]*Team, len(teams))
|
teamMap := make(map[int64]*Team, len(teams))
|
||||||
var teamIDs []int64
|
var teamIDs []int64
|
||||||
|
|
Loading…
Reference in New Issue