Assignee back end

This commit is contained in:
Unknown 2014-05-08 12:24:11 -04:00
parent a03f380fa8
commit e867283406
8 changed files with 96 additions and 46 deletions

View file

@ -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