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
Léo-Paul Géneau
gitlab-ce
Commits
896b9a68
Commit
896b9a68
authored
Dec 26, 2017
by
Mateusz Bajorski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix when branch creation fails don't post system note
Closes #24347
parent
29749f92
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-1
changelogs/unreleased/24347-dont-post-system-note-when-branch-creation-fails.yml
...4347-dont-post-system-note-when-branch-creation-fails.yml
+5
-0
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+14
-0
No files found.
app/controllers/projects/branches_controller.rb
View file @
896b9a68
...
@@ -46,7 +46,7 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -46,7 +46,7 @@ class Projects::BranchesController < Projects::ApplicationController
result
=
CreateBranchService
.
new
(
project
,
current_user
)
result
=
CreateBranchService
.
new
(
project
,
current_user
)
.
execute
(
branch_name
,
ref
)
.
execute
(
branch_name
,
ref
)
if
params
[
:issue_iid
]
if
params
[
:issue_iid
]
&&
result
[
:status
]
==
:success
issue
=
IssuesFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
find_by
(
iid:
params
[
:issue_iid
])
issue
=
IssuesFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
find_by
(
iid:
params
[
:issue_iid
])
SystemNoteService
.
new_issue_branch
(
issue
,
@project
,
current_user
,
branch_name
)
if
issue
SystemNoteService
.
new_issue_branch
(
issue
,
@project
,
current_user
,
branch_name
)
if
issue
end
end
...
...
changelogs/unreleased/24347-dont-post-system-note-when-branch-creation-fails.yml
0 → 100644
View file @
896b9a68
---
title
:
Fix when branch creation fails don't post system note
merge_request
:
author
:
Mateusz Bajorski
type
:
fixed
spec/controllers/projects/branches_controller_spec.rb
View file @
896b9a68
...
@@ -148,6 +148,20 @@ describe Projects::BranchesController do
...
@@ -148,6 +148,20 @@ describe Projects::BranchesController do
end
end
end
end
context
'when create branch service fails'
do
let
(
:branch
)
{
"./invalid-branch-name"
}
it
"doesn't post a system note"
do
expect
(
SystemNoteService
).
not_to
receive
(
:new_issue_branch
)
post
:create
,
namespace_id:
project
.
namespace
,
project_id:
project
,
branch_name:
branch
,
issue_iid:
issue
.
iid
end
end
context
'without issue feature access'
do
context
'without issue feature access'
do
before
do
before
do
project
.
update!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
project
.
update!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
...
...
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