BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
affd376f
Unverified
Commit
affd376f
authored
May 27, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dont show remove source branch ckecbox/button if you dont have such
permissions for MR page Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
d25bc257
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
12 deletions
+2
-12
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+0
-6
merge_request.rb
app/models/merge_request.rb
+0
-4
_mr_accept.html.haml
app/views/projects/merge_requests/show/_mr_accept.html.haml
+1
-1
_remove_source_branch.html.haml
...jects/merge_requests/show/_remove_source_branch.html.haml
+1
-1
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
affd376f
...
@@ -225,7 +225,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -225,7 +225,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff
=
@merge_request
.
merge_request_diff
@merge_request_diff
=
@merge_request
.
merge_request_diff
@allowed_to_merge
=
allowed_to_merge?
@allowed_to_merge
=
allowed_to_merge?
@show_merge_controls
=
@merge_request
.
open?
&&
@commits
.
any?
&&
@allowed_to_merge
@show_merge_controls
=
@merge_request
.
open?
&&
@commits
.
any?
&&
@allowed_to_merge
@allowed_to_remove_source_branch
=
allowed_to_remove_source_branch?
@source_branch
=
@merge_request
.
source_project
.
repository
.
find_branch
(
@merge_request
.
source_branch
).
try
(
:name
)
@source_branch
=
@merge_request
.
source_project
.
repository
.
find_branch
(
@merge_request
.
source_branch
).
try
(
:name
)
end
end
...
@@ -238,11 +237,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -238,11 +237,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render
'invalid'
render
'invalid'
end
end
def
allowed_to_remove_source_branch?
allowed_to_push_code?
(
@merge_request
.
source_project
,
@merge_request
.
source_branch
)
&&
!
@merge_request
.
disallow_source_branch_removal?
end
def
allowed_to_push_code?
(
project
,
branch
)
def
allowed_to_push_code?
(
project
,
branch
)
action
=
if
project
.
protected_branch?
(
branch
)
action
=
if
project
.
protected_branch?
(
branch
)
:push_code_to_protected_branches
:push_code_to_protected_branches
...
...
app/models/merge_request.rb
View file @
affd376f
...
@@ -212,10 +212,6 @@ class MergeRequest < ActiveRecord::Base
...
@@ -212,10 +212,6 @@ class MergeRequest < ActiveRecord::Base
target_project
!=
source_project
target_project
!=
source_project
end
end
def
disallow_source_branch_removal?
source_project
.
root_ref?
(
source_branch
)
||
source_project
.
protected_branches
.
include?
(
source_branch
)
end
def
project
def
project
target_project
target_project
end
end
...
...
app/views/projects/merge_requests/show/_mr_accept.html.haml
View file @
affd376f
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
.accept-group
.accept-group
.pull-left
.pull-left
=
f
.
submit
"Accept Merge Request"
,
class:
"btn btn-create accept_merge_request"
=
f
.
submit
"Accept Merge Request"
,
class:
"btn btn-create accept_merge_request"
-
unless
@merge_request
.
disallow_source_branch_removal?
-
if
can_remove_branch?
(
@merge_request
.
source_project
,
@merge_request
.
source_branch
)
.remove_branch_holder.pull-left
.remove_branch_holder.pull-left
=
label_tag
:should_remove_source_branch
,
class:
"checkbox"
do
=
label_tag
:should_remove_source_branch
,
class:
"checkbox"
do
=
check_box_tag
:should_remove_source_branch
=
check_box_tag
:should_remove_source_branch
...
...
app/views/projects/merge_requests/show/_remove_source_branch.html.haml
View file @
affd376f
-
if
@source_branch
.
blank?
-
if
@source_branch
.
blank?
Source branch has been removed
Source branch has been removed
-
elsif
@allowed_to_remove_source_branch
&&
@merge_request
.
merged?
-
elsif
can_remove_branch?
(
@merge_request
.
source_project
,
@merge_request
.
source_branch
)
&&
@merge_request
.
merged?
.remove_source_branch_widget
.remove_source_branch_widget
%p
Changes merged into
#{
@merge_request
.
target_branch
}
. You can remove source branch now
%p
Changes merged into
#{
@merge_request
.
target_branch
}
. You can remove source branch now
=
link_to
project_branch_path
(
@merge_request
.
source_project
,
@source_branch
),
remote:
true
,
method: :delete
,
class:
"btn btn-primary btn-small remove_source_branch"
do
=
link_to
project_branch_path
(
@merge_request
.
source_project
,
@source_branch
),
remote:
true
,
method: :delete
,
class:
"btn btn-primary btn-small remove_source_branch"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment