mirror of
https://github.com/gogs/gogs.git
synced 2025-12-20 07:09:58 +01:00
models/user: handle case when user doesn't belong to any organization (#4258)
This commit is contained in:
2
gogs.go
2
gogs.go
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.10.9.0308"
|
const APP_VER = "0.10.10.0308"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setting.AppVer = APP_VER
|
setting.AppVer = APP_VER
|
||||||
|
|||||||
@@ -453,6 +453,9 @@ func (u *User) GetOrganizations(showPrivate bool) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("GetOrgIDsByUserID: %v", err)
|
return fmt.Errorf("GetOrgIDsByUserID: %v", err)
|
||||||
}
|
}
|
||||||
|
if len(orgIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
u.Orgs = make([]*User, 0, len(orgIDs))
|
u.Orgs = make([]*User, 0, len(orgIDs))
|
||||||
if err = x.In("id", orgIDs).Find(&u.Orgs); err != nil {
|
if err = x.In("id", orgIDs).Find(&u.Orgs); err != nil {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0.10.9.0308
|
0.10.10.0308
|
||||||
Reference in New Issue
Block a user