diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ca07dccdc..7c12ff8ab 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -75,6 +75,9 @@ class RepositoriesController < ApplicationController redirect_to repository_url(@repository) else g = Gitlab.client + if User.current.gid.nil? + g.sync_user(User.current) + end gproject = g.fork(@project.gpid, User.current.gid) if gproject copy_project(@project, gproject) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 00d79cd54..9464cc97b 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,14 +25,12 @@
-<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> - <% if User.current.id != @project.user_id || User.current.projects.count !=0 %> - <% unless User.current.id == @project.user_id %> + <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> + <% if User.current.id != @project.user_id %>