Skip to content

Commit

Permalink
(refs #1463)Copy collaborators form source repository for private fork
Browse files Browse the repository at this point in the history
  • Loading branch information
takezoe committed Feb 26, 2017
1 parent 16f0b68 commit ae4da97
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/scala/gitbucket/core/controller/AccountController.scala
Expand Up @@ -2,15 +2,14 @@ package gitbucket.core.controller

import gitbucket.core.account.html
import gitbucket.core.helper
import gitbucket.core.model.GroupMember
import gitbucket.core.model.{GroupMember, Role}
import gitbucket.core.service._
import gitbucket.core.ssh.SshUtil
import gitbucket.core.util.ControlUtil._
import gitbucket.core.util.Directory._
import gitbucket.core.util.Implicits._
import gitbucket.core.util.StringUtil._
import gitbucket.core.util._

import io.github.gitbucket.scalatra.forms._
import org.apache.commons.io.FileUtils
import org.scalatra.i18n.Messages
Expand Down Expand Up @@ -407,13 +406,15 @@ trait AccountControllerBase extends AccountManagementControllerBase {
parentUserName = Some(repository.owner)
)

// // Add collaborators for group repository
// val ownerAccount = getAccountByUserName(accountName).get
// if(ownerAccount.isGroupAccount){
// getGroupMembers(accountName).foreach { member =>
// addCollaborator(accountName, repository.name, member.userName)
// }
// }
// Set default collaborators for the private fork
if(repository.repository.isPrivate){
// Copy collaborators from the source repository
getCollaborators(repository.owner, repository.name).foreach { case (collaborator, _) =>
addCollaborator(accountName, repository.name, collaborator.collaboratorName, collaborator.role)
}
// Register an owner of the source repository as a collaborator
addCollaborator(accountName, repository.name, repository.owner, Role.ADMIN.name)
}

// Insert default labels
insertDefaultLabels(accountName, repository.name)
Expand Down

0 comments on commit ae4da97

Please sign in to comment.