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