Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
aa1ba009
Commit
aa1ba009
authored
Nov 24, 2015
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure "Remove Source Branch" button is not shown when branch is being deleted. #3583
parent
238ca3e4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
6 deletions
+62
-6
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/merge_request_widget.js.coffee
app/assets/javascripts/merge_request_widget.js.coffee
+6
-3
app/helpers/gitlab_routing_helper.rb
app/helpers/gitlab_routing_helper.rb
+1
-1
app/views/projects/merge_requests/merge.js.haml
app/views/projects/merge_requests/merge.js.haml
+1
-1
app/views/projects/merge_requests/widget/_merged.html.haml
app/views/projects/merge_requests/widget/_merged.html.haml
+1
-1
features/project/merge_requests/accept.feature
features/project/merge_requests/accept.feature
+17
-0
features/steps/project/merge_requests/acceptance.rb
features/steps/project/merge_requests/acceptance.rb
+35
-0
No files found.
CHANGELOG
View file @
aa1ba009
...
...
@@ -9,6 +9,7 @@ v 8.3.0 (unreleased)
- Don't show project fork event as "imported"
- Add API endpoint to fetch merge request commits list
- Expose events API with comment information and author info
- Fix: Ensure "Remove Source Branch" button is not shown when branch is being deleted. #3583
v 8.2.2
- Fix 404 in redirection after removing a project (Stan Hu)
...
...
app/assets/javascripts/merge_request_widget.js.coffee
View file @
aa1ba009
...
...
@@ -10,17 +10,20 @@ class @MergeRequestWidget
constructor
:
(
@
opts
)
->
modal
=
$
(
'#modal_merge_info'
).
modal
(
show
:
false
)
mergeInProgress
:
->
mergeInProgress
:
(
deleteSourceBranch
=
false
)
->
$
.
ajax
type
:
'GET'
url
:
$
(
'.merge-request'
).
data
(
'url'
)
success
:
(
data
)
=>
if
data
.
state
==
"merged"
location
.
reload
()
urlSuffix
=
if
deleteSourceBranch
then
'?delete_source=true'
else
''
window
.
location
.
href
=
window
.
location
.
href
+
urlSuffix
else
if
data
.
merge_error
$
(
'.mr-widget-body'
).
html
(
"<h4>"
+
data
.
merge_error
+
"</h4>"
)
else
setTimeout
(
merge_request_widget
.
mergeInProgress
,
2000
)
callback
=
->
merge_request_widget
.
mergeInProgress
(
deleteSourceBranch
)
setTimeout
(
callback
,
2000
)
dataType
:
'json'
getMergeStatus
:
->
...
...
app/helpers/gitlab_routing_helper.rb
View file @
aa1ba009
...
...
@@ -6,7 +6,7 @@
#
# For example instead of this:
#
# namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project
s
, merge_request)
# namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request)
#
# We can simply use shortcut:
#
...
...
app/views/projects/merge_requests/merge.js.haml
View file @
aa1ba009
-
if
@status
:plain
merge_request_widget.mergeInProgress();
merge_request_widget.mergeInProgress(
#{
params
[
:should_remove_source_branch
]
==
'1'
}
);
-
else
:plain
$('.mr-widget-body').html("
#{
escape_javascript
(
render
(
'projects/merge_requests/widget/open/reload'
))
}
");
app/views/projects/merge_requests/widget/_merged.html.haml
View file @
aa1ba009
...
...
@@ -7,7 +7,7 @@
by
#{
link_to_member
(
@project
,
@merge_request
.
merge_event
.
author
,
avatar:
true
)
}
#{
time_ago_with_tooltip
(
@merge_request
.
merge_event
.
created_at
)
}
%div
-
if
!
@merge_request
.
source_branch_exists?
-
if
!
@merge_request
.
source_branch_exists?
||
(
params
[
:delete_source
]
==
'true'
)
=
succeed
'.'
do
The changes were merged into
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
do
...
...
features/project/merge_requests/accept.feature
0 → 100644
View file @
aa1ba009
Feature
:
Project Merge Requests Acceptance
Background
:
Given
There is an open Merge Request
And
I am signed in as a developer of the project
@javascript
Scenario
:
Accepting the Merge Request and removing the source branch
Given
I am on the Merge Request detail page
When
I click on
"Remove source branch"
option
And
I click on Accept Merge Request
Then
I should not see the Remove Source Branch button
@javascript
Scenario
:
Accepting the Merge Request without removing the source branch
Given
I am on the Merge Request detail page
When
I click on Accept Merge Request
Then
I should see the Remove Source Branch button
features/steps/project/merge_requests/acceptance.rb
0 → 100644
View file @
aa1ba009
class
Spinach::Features::ProjectMergeRequestsAcceptance
<
Spinach
::
FeatureSteps
include
LoginHelpers
include
GitlabRoutingHelper
step
'I am on the Merge Request detail page'
do
visit
merge_request_path
(
@merge_request
)
end
step
'I click on "Remove source branch" option'
do
check
(
'Remove source branch'
)
end
step
'I click on Accept Merge Request'
do
click_button
(
'Accept Merge Request'
)
end
step
'I should see the Remove Source Branch button'
do
expect
(
page
).
to
have_link
(
'Remove Source Branch'
)
end
step
'I should not see the Remove Source Branch button'
do
expect
(
page
).
not_to
have_link
(
'Remove Source Branch'
)
end
step
'There is an open Merge Request'
do
@user
=
create
(
:user
)
@project
=
create
(
:project
,
:public
)
@project_member
=
create
(
:project_member
,
user:
@user
,
project:
@project
,
access_level:
ProjectMember
::
DEVELOPER
)
@merge_request
=
create
(
:merge_request
,
:with_diffs
,
:simple
,
source_project:
@project
)
end
step
'I am signed in as a developer of the project'
do
login_as
(
@user
)
end
end
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