summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-01 11:32:12 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-01 11:32:12 -0400
commitf6c4fbeb37bc7fcbc947c162358c39e9bed90488 (patch)
tree37d9ba100ba006b9d322014bff1975014b8f3fd3 /models/repo.go
parent0dfb5560cdee369b2292071d14d750b2477c6086 (diff)
downloadgitea-f6c4fbeb37bc7fcbc947c162358c39e9bed90488.tar.gz
gitea-f6c4fbeb37bc7fcbc947c162358c39e9bed90488.zip
Collaborator
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go
index 5e19378721..be889cba5f 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -712,6 +712,20 @@ func GetRepositoryCount(user *User) (int64, error) {
return orm.Count(&Repository{OwnerId: user.Id})
}
+// GetCollaborators returns a list of user name of repository's collaborators.
+func GetCollaborators(repoName string) ([]string, error) {
+ accesses := make([]*Access, 0, 10)
+ if err := orm.Find(&accesses, &Access{RepoName: strings.ToLower(repoName)}); err != nil {
+ return nil, err
+ }
+
+ names := make([]string, len(accesses))
+ for i := range accesses {
+ names[i] = accesses[i].UserName
+ }
+ return names, nil
+}
+
// Watch is connection request for receiving repository notifycation.
type Watch struct {
Id int64