diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-19 19:41:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 19:41:40 +0800 |
commit | 7a0347315995b25bcb2dca4786504fb699b5f004 (patch) | |
tree | 803dfd39286216fd0521ad16539ffd9fc5f87fc0 /routers/web/user/home.go | |
parent | a09b40de8d1dae7107437cfba42cee201fcd6d42 (diff) | |
download | gitea-7a0347315995b25bcb2dca4786504fb699b5f004.tar.gz gitea-7a0347315995b25bcb2dca4786504fb699b5f004.zip |
Use a standalone struct name for Organization (#17632)
* Use a standalone struct name for Organization
* recover unnecessary change
* make the code readable
* Fix template failure
* Fix template failure
* Move HasMemberWithUserID to org
* Fix test
* Remove unnecessary user type check
* Fix test
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/web/user/home.go')
-rw-r--r-- | routers/web/user/home.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go index b9f5d044fa..c0ecd0c2a0 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -47,8 +47,8 @@ func getDashboardContextUser(ctx *context.Context) *models.User { ctxUser := ctx.User orgName := ctx.Params(":org") if len(orgName) > 0 { - ctxUser = ctx.Org.Organization - ctx.Data["Teams"] = ctx.Org.Organization.Teams + ctxUser = ctx.Org.Organization.AsUser() + ctx.Data["Teams"] = ctx.Org.Teams } ctx.Data["ContextUser"] = ctxUser @@ -97,9 +97,9 @@ func Dashboard(ctx *context.Context) { if ctxUser.IsOrganization() { var env models.AccessibleReposEnvironment if ctx.Org.Team != nil { - env = ctxUser.AccessibleTeamReposEnv(ctx.Org.Team) + env = models.OrgFromUser(ctxUser).AccessibleTeamReposEnv(ctx.Org.Team) } else { - env, err = ctxUser.AccessibleReposEnv(ctx.User.ID) + env, err = models.OrgFromUser(ctxUser).AccessibleReposEnv(ctx.User.ID) if err != nil { ctx.ServerError("AccessibleReposEnv", err) return @@ -756,9 +756,9 @@ func getActiveTeamOrOrgRepoIds(ctxUser *models.User, team *models.Team, unitType var env models.AccessibleReposEnvironment if team != nil { - env = ctxUser.AccessibleTeamReposEnv(team) + env = models.OrgFromUser(ctxUser).AccessibleTeamReposEnv(team) } else { - env, err = ctxUser.AccessibleReposEnv(ctxUser.ID) + env, err = models.OrgFromUser(ctxUser).AccessibleReposEnv(ctxUser.ID) if err != nil { return nil, fmt.Errorf("AccessibleReposEnv: %v", err) } |