|
|
@@ -60,7 +60,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
Integer namespaceId=gitlabUser.getNamespaceId();
|
|
|
Project project;
|
|
|
try{
|
|
|
- gitlabApi.setSudoAsId(userId);
|
|
|
+ gitlabApi.setSudoAsId(gitlabUser.getGitlabUserId());
|
|
|
project=gitlabApi.getProjectApi().forkProject(projectId,namespaceId);
|
|
|
project.setVisibility(Visibility.PRIVATE);
|
|
|
project=gitlabApi.getProjectApi().updateProject(project);
|
|
|
@@ -259,8 +259,9 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
}
|
|
|
|
|
|
private GitlabUser getGitlabUser(int userId) throws GitLabApiException {
|
|
|
- if(gitlabUserRepository.existsById(userId))
|
|
|
- return gitlabUserRepository.getOne(userId);
|
|
|
+ GitlabUser user = gitlabUserRepository.findByUserId(userId);
|
|
|
+ if(user != null)
|
|
|
+ return user;
|
|
|
else
|
|
|
throw new GitLabApiException("user not exists");
|
|
|
}
|