diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb
index 5e21f9af0..b67a74439 100644
--- a/app/controllers/pull_requests_controller.rb
+++ b/app/controllers/pull_requests_controller.rb
@@ -1,8 +1,10 @@
class PullRequestsController < ApplicationController
+ before_filter :authorize_logged
before_filter :find_project_and_repository
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new,
:update_pull_request, :pull_request_comments, :create_pull_request_comment]
+
layout "base_projects"
include PullRequestsHelper
include ApplicationHelper
@@ -235,6 +237,13 @@ class PullRequestsController < ApplicationController
end
private
+ def authorize_logged
+ if !User.current.logged?
+ redirect_to signin_path
+ return
+ end
+ end
+
def connect_gitlab
@g = Gitlab.client
end
diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb
index 273fcf56a..82bcb5501 100644
--- a/app/views/projects/_development_group.html.erb
+++ b/app/views/projects/_development_group.html.erb
@@ -40,12 +40,12 @@
<% end %>
-<% if allow_pull_request(@project) %>
-
- <%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
+
+ <%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
+ <% if allow_pull_request(@project) %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
-
-<% end %>
+ <% end %>
+
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% if visible_repository?(@project) %>
diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb
index b750728a4..758f70878 100644
--- a/app/views/pull_requests/_show.html.erb
+++ b/app/views/pull_requests/_show.html.erb
@@ -5,8 +5,10 @@
<%= get_state(@request.state) %>合并请求 由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %> 于 <%= time_tag(@request.created_at) %> 前提交 · 最后编辑时间 <%= time_tag(@request.updated_at) %> 前
- <% unless @request.state == "merged" %>
- <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %>
+ <% if User.current.login == @request.author.try(:username) || is_project_manager?(User.current.id, @project.id) %>
+ <% unless @request.state == "merged" %>
+ <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %>
+ <% end %>
<% end %>
diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb
index 78c4759aa..f4fe0725e 100644
--- a/app/views/pull_requests/index.html.erb
+++ b/app/views/pull_requests/index.html.erb
@@ -3,8 +3,9 @@
<%= link_to "待处理#{@requests_opened_count}".html_safe, project_pull_requests_path(:type => "1"), :remote => true %>
<%= link_to "已处理#{@requests_merged_count}".html_safe, project_pull_requests_path(:type => "2"), :remote => true %>
<%= link_to "已关闭#{@requests_closed_count}".html_safe, project_pull_requests_path(:type => "3"), :remote => true %>
-
- <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
+ <% if allow_pull_request(@project) %>
+ <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
+ <% end %>