mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-28 12:00:01 +02:00
Remove unit types commits and settings (#2161)
* Remove unit types commits and settings * Can not limit units in administrator teams * Limit changing units only to teams with read and write access mode * Small code optimization
This commit is contained in:
parent
047a67a90b
commit
f33e6ae09e
20 changed files with 174 additions and 104 deletions
|
@ -26,15 +26,15 @@ type RepoUnit struct {
|
|||
|
||||
// Enumerate all the unit types
|
||||
const (
|
||||
UnitTypeCode = iota + 1 // 1 code
|
||||
UnitTypeIssues // 2 issues
|
||||
UnitTypePRs // 3 PRs
|
||||
UnitTypeCommits // 4 Commits
|
||||
UnitTypeReleases // 5 Releases
|
||||
UnitTypeWiki // 6 Wiki
|
||||
UnitTypeSettings // 7 Settings
|
||||
UnitTypeExternalWiki // 8 ExternalWiki
|
||||
UnitTypeExternalTracker // 9 ExternalTracker
|
||||
V16UnitTypeCode = iota + 1 // 1 code
|
||||
V16UnitTypeIssues // 2 issues
|
||||
V16UnitTypePRs // 3 PRs
|
||||
V16UnitTypeCommits // 4 Commits
|
||||
V16UnitTypeReleases // 5 Releases
|
||||
V16UnitTypeWiki // 6 Wiki
|
||||
V16UnitTypeSettings // 7 Settings
|
||||
V16UnitTypeExternalWiki // 8 ExternalWiki
|
||||
V16UnitTypeExternalTracker // 9 ExternalTracker
|
||||
)
|
||||
|
||||
// Repo describes a repository
|
||||
|
@ -79,32 +79,32 @@ func addUnitsToTables(x *xorm.Engine) error {
|
|||
|
||||
for _, repo := range repos {
|
||||
for i := 1; i <= 9; i++ {
|
||||
if (i == UnitTypeWiki || i == UnitTypeExternalWiki) && !repo.EnableWiki {
|
||||
if (i == V16UnitTypeWiki || i == V16UnitTypeExternalWiki) && !repo.EnableWiki {
|
||||
continue
|
||||
}
|
||||
if i == UnitTypeExternalWiki && !repo.EnableExternalWiki {
|
||||
if i == V16UnitTypeExternalWiki && !repo.EnableExternalWiki {
|
||||
continue
|
||||
}
|
||||
if i == UnitTypePRs && !repo.EnablePulls {
|
||||
if i == V16UnitTypePRs && !repo.EnablePulls {
|
||||
continue
|
||||
}
|
||||
if (i == UnitTypeIssues || i == UnitTypeExternalTracker) && !repo.EnableIssues {
|
||||
if (i == V16UnitTypeIssues || i == V16UnitTypeExternalTracker) && !repo.EnableIssues {
|
||||
continue
|
||||
}
|
||||
if i == UnitTypeExternalTracker && !repo.EnableExternalTracker {
|
||||
if i == V16UnitTypeExternalTracker && !repo.EnableExternalTracker {
|
||||
continue
|
||||
}
|
||||
|
||||
var config = make(map[string]string)
|
||||
switch i {
|
||||
case UnitTypeExternalTracker:
|
||||
case V16UnitTypeExternalTracker:
|
||||
config["ExternalTrackerURL"] = repo.ExternalTrackerURL
|
||||
config["ExternalTrackerFormat"] = repo.ExternalTrackerFormat
|
||||
if len(repo.ExternalTrackerStyle) == 0 {
|
||||
repo.ExternalTrackerStyle = markdown.IssueNameStyleNumeric
|
||||
}
|
||||
config["ExternalTrackerStyle"] = repo.ExternalTrackerStyle
|
||||
case UnitTypeExternalWiki:
|
||||
case V16UnitTypeExternalWiki:
|
||||
config["ExternalWikiURL"] = repo.ExternalWikiURL
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue