diff options
author | Unknwon <u@gogs.io> | 2015-12-04 21:30:33 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-04 21:30:33 -0500 |
commit | e538ff27704cddb1a99efc1a6be19e134f97355f (patch) | |
tree | 88f93b17d47aeb3ac4dd0692f5c5b613ee38b28b /models | |
parent | 76d4b9288b60ed6c037257415a570225764ff0a0 (diff) | |
download | gitea-e538ff27704cddb1a99efc1a6be19e134f97355f.tar.gz gitea-e538ff27704cddb1a99efc1a6be19e134f97355f.zip |
fix #1829 and fix #890
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index b4ad19c069..47cebb6c92 100644 --- a/models/repo.go +++ b/models/repo.go @@ -161,6 +161,14 @@ type Repository struct { IsMirror bool *Mirror `xorm:"-"` + // Advanced settings + EnableWiki bool `xorm:"NOT NULL DEFAULT true"` + EnableIssues bool `xorm:"NOT NULL DEFAULT true"` + EnableExternalTracker bool + ExternalTrackerFormat string + ExternalMetas map[string]string `xorm:"-"` + EnablePulls bool `xorm:"NOT NULL DEFAULT true"` + IsFork bool `xorm:"NOT NULL DEFAULT false"` ForkID int64 BaseRepo *Repository `xorm:"-"` @@ -214,6 +222,20 @@ func (repo *Repository) MustOwner() *User { return repo.mustOwner(x) } +// ComposeMetas composes a map of metas for rendering external issue tracker URL. +func (repo *Repository) ComposeMetas() map[string]string { + if !repo.EnableExternalTracker { + return nil + } else if repo.ExternalMetas == nil { + repo.ExternalMetas = map[string]string{ + "format": repo.ExternalTrackerFormat, + "user": repo.MustOwner().Name, + "repo": repo.Name, + } + } + return repo.ExternalMetas +} + // GetAssignees returns all users that have write access of repository. func (repo *Repository) GetAssignees() (_ []*User, err error) { if err = repo.GetOwner(); err != nil { |