From 7c34122ff6ef4ccf001d273b63055f52d2bce3b4 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 8 Dec 2015 09:46:29 +0800 Subject: [PATCH] =?UTF-8?q?fork=E7=9A=84=E6=97=B6=E5=80=99=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E7=94=A8=E6=88=B7=E6=B2=A1=E6=9C=89=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 3 +++ app/views/repositories/show.html.erb | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) 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 @@
ZIP
-<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> - <% 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 %>
<%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%> <%= @project.forked_count.to_i %>
<% end %> - <% end %>
<% if @changesets && !@changesets.empty? %>