summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go
index 595d79b5c3..e97164d26b 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -713,8 +713,8 @@ 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) {
+// GetCollaboratorNames returns a list of user name of repository's collaborators.
+func GetCollaboratorNames(repoName string) ([]string, error) {
accesses := make([]*Access, 0, 10)
if err := orm.Find(&accesses, &Access{RepoName: strings.ToLower(repoName)}); err != nil {
return nil, err
@@ -727,6 +727,23 @@ func GetCollaborators(repoName string) ([]string, error) {
return names, nil
}
+// GetCollaborators returns a list of users of repository's collaborators.
+func GetCollaborators(repoName string) (us []*User, err error) {
+ accesses := make([]*Access, 0, 10)
+ if err = orm.Find(&accesses, &Access{RepoName: strings.ToLower(repoName)}); err != nil {
+ return nil, err
+ }
+
+ us = make([]*User, len(accesses))
+ for i := range accesses {
+ us[i], err = GetUserByName(accesses[i].UserName)
+ if err != nil {
+ return nil, err
+ }
+ }
+ return us, nil
+}
+
// Watch is connection request for receiving repository notifycation.
type Watch struct {
Id int64