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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
38e708f0
Commit
38e708f0
authored
Feb 08, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add link to fork if user can't revert MR.
parent
9d4c105a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
3 deletions
+23
-3
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+1
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+7
-0
app/models/repository.rb
app/models/repository.rb
+2
-0
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+2
-0
app/views/projects/merge_requests/show/_mr_title.html.haml
app/views/projects/merge_requests/show/_mr_title.html.haml
+11
-2
No files found.
app/controllers/concerns/creates_commit.rb
View file @
38e708f0
...
...
@@ -108,7 +108,7 @@ module CreatesCommit
# Merge request from fork to this project
@mr_source_project
=
@tree_edit_project
@mr_target_project
=
@project
@mr_target_branch
=
@ref
@mr_target_branch
||
=
@ref
end
end
end
app/helpers/merge_requests_helper.rb
View file @
38e708f0
...
...
@@ -92,4 +92,11 @@ module MergeRequestsHelper
[
"
#{
source_path
}
:
#{
source_branch
}
"
,
"
#{
target_path
}
:
#{
target_branch
}
"
]
end
end
def
can_update_merge_request?
project
||=
@project
can?
(
current_user
,
:update_merge_request
,
project
)
||
(
current_user
&&
current_user
.
already_forked?
(
project
))
end
end
app/models/repository.rb
View file @
38e708f0
...
...
@@ -628,6 +628,8 @@ class Repository
args
=
[
commit
.
id
,
source_sha
]
args
<<
{
mainline:
1
}
if
commit
.
is_a_merge_commit?
# Temporary branch exists and contains the revert commit
return
true
if
create_mr
&&
find_branch
(
target_branch
)
return
false
unless
diff_exists?
(
source_sha
,
commit
.
id
)
revert_index
=
rugged
.
revert_commit
(
*
args
)
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
38e708f0
...
...
@@ -85,6 +85,8 @@
=
spinner
=
render
'shared/issuable/sidebar'
,
issuable:
@merge_request
-
if
@merge_request
.
merge_commit_sha
=
render
"projects/commit/revert"
,
commit_id:
@merge_request
.
merge_commit_sha
:javascript
var
merge_request
;
...
...
app/views/projects/merge_requests/show/_mr_title.html.haml
View file @
38e708f0
...
...
@@ -18,7 +18,16 @@
Edit
-
if
@merge_request
.
closed?
=
link_to
'Reopen'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
'btn btn-nr btn-grouped btn-reopen reopen-mr-link'
,
title:
"Reopen merge request"
-
if
@merge_request
.
merged?
&&
@merge_request
.
merge_commit_sha
.
present?
=
render
"projects/commit/revert"
,
commit_id:
@merge_request
.
merge_commit_sha
-
if
@merge_request
.
merged?
&&
@merge_request
.
merge_commit_sha
.
present?
-
if
can_update_merge_request?
=
link_to
'#modal-revert-commit'
,
{
'data-target'
=>
'#modal-revert-commit'
,
'data-toggle'
=>
'modal'
,
class:
'btn btn-grouped btn-close'
}
do
Revert
-
else
-
continue_params
=
{
to:
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
notice:
edit_in_new_fork_notice
,
notice_now:
edit_in_new_fork_notice_now
}
-
fork_path
=
namespace_project_forks_path
(
@project
.
namespace
,
@project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
=
link_to
fork_path
,
{
class:
'btn btn-grouped btn-close'
,
method: :post
}
do
Revert
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