|
|
@ -8,12 +8,10 @@ import ( |
|
|
|
"gopkg.in/macaron.v1" |
|
|
|
"gopkg.in/macaron.v1" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
"github.com/gogits/gogs/modules/log" |
|
|
|
|
|
|
|
"github.com/gogits/gogs/modules/setting" |
|
|
|
"github.com/gogits/gogs/modules/setting" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func OrgAssignment(redirect bool, args ...bool) macaron.Handler { |
|
|
|
func HandleOrgAssignment(ctx *Context, args ...bool) { |
|
|
|
return func(ctx *Context) { |
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
requireMember bool |
|
|
|
requireMember bool |
|
|
|
requireOwner bool |
|
|
|
requireOwner bool |
|
|
@ -36,9 +34,6 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if models.IsErrUserNotExist(err) { |
|
|
|
if models.IsErrUserNotExist(err) { |
|
|
|
ctx.Handle(404, "GetUserByName", err) |
|
|
|
ctx.Handle(404, "GetUserByName", err) |
|
|
|
} else if redirect { |
|
|
|
|
|
|
|
log.Error(4, "GetUserByName", err) |
|
|
|
|
|
|
|
ctx.Redirect(setting.AppSubUrl + "/") |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ctx.Handle(500, "GetUserByName", err) |
|
|
|
ctx.Handle(500, "GetUserByName", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -84,9 +79,6 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if err == models.ErrTeamNotExist { |
|
|
|
if err == models.ErrTeamNotExist { |
|
|
|
ctx.Handle(404, "GetTeam", err) |
|
|
|
ctx.Handle(404, "GetTeam", err) |
|
|
|
} else if redirect { |
|
|
|
|
|
|
|
log.Error(4, "GetTeam", err) |
|
|
|
|
|
|
|
ctx.Redirect(setting.AppSubUrl + "/") |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ctx.Handle(500, "GetTeam", err) |
|
|
|
ctx.Handle(500, "GetTeam", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -100,5 +92,10 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler { |
|
|
|
ctx.Handle(404, "OrgAssignment", err) |
|
|
|
ctx.Handle(404, "OrgAssignment", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func OrgAssignment(args ...bool) macaron.Handler { |
|
|
|
|
|
|
|
return func(ctx *Context) { |
|
|
|
|
|
|
|
HandleOrgAssignment(ctx, args...) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|