diff --git a/modules/context/context.go b/modules/context/context.go index 807b6dab1..fd980fc6d 100755 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -65,15 +65,6 @@ func (ctx *Context) IsUserRepoAdmin() bool { return ctx.Repo.IsAdmin() } -func (ctx *Context) IsCourse() bool { - if ctx.Org != nil && ctx.Org.Organization != nil { - if ctx.Org.Organization.Name == setting.Course.OrgName { - return true - } - } - return false -} - // IsUserRepoWriter returns true if current user has write privilege in current repo func (ctx *Context) IsUserRepoWriter(unitTypes []models.UnitType) bool { for _, unitType := range unitTypes { diff --git a/modules/context/org.go b/modules/context/org.go index 9b87fba9f..7baf61ea8 100644 --- a/modules/context/org.go +++ b/modules/context/org.go @@ -63,6 +63,8 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { org := ctx.Org.Organization ctx.Data["Org"] = org + ctx.Data["IsCourse"] = orgName == setting.Course.OrgName + // Force redirection when username is actually a user. if !org.IsOrganization() { ctx.Redirect(setting.AppSubURL + "/" + org.Name)