aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/fixtures/repo_unit.yml1
-rw-r--r--models/repo/repo.go4
-rw-r--r--models/repo/repo_unit.go2
-rw-r--r--templates/repo/settings/options.tmpl12
4 files changed, 10 insertions, 9 deletions
diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml
index 6714294e2b..8a22db0445 100644
--- a/models/fixtures/repo_unit.yml
+++ b/models/fixtures/repo_unit.yml
@@ -520,7 +520,6 @@
id: 75
repo_id: 1
type: 8
- config: "{\"ProjectsMode\":\"all\"}"
created_unix: 946684810
-
diff --git a/models/repo/repo.go b/models/repo/repo.go
index ad2e21b66b..f6758f1591 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -412,9 +412,11 @@ func (repo *Repository) MustGetUnit(ctx context.Context, tp unit.Type) *RepoUnit
Config: new(ActionsConfig),
}
} else if tp == unit.TypeProjects {
+ cfg := new(ProjectsConfig)
+ cfg.ProjectsMode = ProjectsModeNone
return &RepoUnit{
Type: tp,
- Config: new(ProjectsConfig),
+ Config: cfg,
}
}
diff --git a/models/repo/repo_unit.go b/models/repo/repo_unit.go
index 6b9dde7faf..5a841f4d31 100644
--- a/models/repo/repo_unit.go
+++ b/models/repo/repo_unit.go
@@ -236,7 +236,7 @@ func (cfg *ProjectsConfig) GetProjectsMode() ProjectsMode {
return cfg.ProjectsMode
}
- return ProjectsModeNone
+ return ProjectsModeAll
}
func (cfg *ProjectsConfig) IsProjectsAllowed(m ProjectsMode) bool {
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 376cfe7607..0de42b34ea 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -460,19 +460,19 @@
</p>
<div class="ui dropdown selection">
<select name="projects_mode">
- <option value="repo" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.ProjectsMode "repo")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}</option>
- <option value="owner" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.ProjectsMode "owner")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}</option>
- <option value="all" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.ProjectsMode "all")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}</option>
+ <option value="repo" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "repo")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}</option>
+ <option value="owner" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "owner")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}</option>
+ <option value="all" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "all")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}</option>
</select>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="default text">
- {{if (eq $projectsUnit.ProjectsConfig.ProjectsMode "repo")}}
+ {{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "repo")}}
{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}
{{end}}
- {{if (eq $projectsUnit.ProjectsConfig.ProjectsMode "owner")}}
+ {{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "owner")}}
{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}
{{end}}
- {{if (eq $projectsUnit.ProjectsConfig.ProjectsMode "all")}}
+ {{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "all")}}
{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}
{{end}}
</div>