Browse Source

增加iscourse变量

tags/v1.22.1.3^2
ychao_1983 3 years ago
parent
commit
80b09207fa
2 changed files with 2 additions and 9 deletions
  1. +0
    -9
      modules/context/context.go
  2. +2
    -0
      modules/context/org.go

+ 0
- 9
modules/context/context.go View File

@@ -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 {


+ 2
- 0
modules/context/org.go View File

@@ -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)


Loading…
Cancel
Save