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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ac1b353e
Commit
ac1b353e
authored
Dec 27, 2017
by
Mateusz Bajorski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor success status in branch controller
parent
896b9a68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+5
-3
No files found.
app/controllers/projects/branches_controller.rb
View file @
ac1b353e
...
@@ -46,14 +46,16 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -46,14 +46,16 @@ 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
]
&&
result
[
:status
]
==
:success
success
=
(
result
[
:status
]
==
:success
)
if
params
[
:issue_iid
]
&&
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
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
if
result
[
:status
]
==
:
success
if
success
if
redirect_to_autodeploy
if
redirect_to_autodeploy
redirect_to
url_to_autodeploy_setup
(
project
,
branch_name
),
redirect_to
url_to_autodeploy_setup
(
project
,
branch_name
),
notice:
view_context
.
autodeploy_flash_notice
(
branch_name
)
notice:
view_context
.
autodeploy_flash_notice
(
branch_name
)
...
@@ -67,7 +69,7 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -67,7 +69,7 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
format
.
json
do
format
.
json
do
if
result
[
:status
]
==
:
success
if
success
render
json:
{
name:
branch_name
,
url:
project_tree_url
(
@project
,
branch_name
)
}
render
json:
{
name:
branch_name
,
url:
project_tree_url
(
@project
,
branch_name
)
}
else
else
render
json:
result
[
:messsage
],
status: :unprocessable_entity
render
json:
result
[
:messsage
],
status: :unprocessable_entity
...
...
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