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
31c37c6c
Commit
31c37c6c
authored
Sep 02, 2016
by
Katarzyna Kobierska
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add #closed_without_source_project?
parent
09cded29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
19 deletions
+26
-19
app/models/merge_request.rb
app/models/merge_request.rb
+5
-1
app/views/projects/merge_requests/_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+1
-1
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+17
-14
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+3
-3
No files found.
app/models/merge_request.rb
View file @
31c37c6c
...
...
@@ -313,7 +313,11 @@ class MergeRequest < ActiveRecord::Base
end
def
closed_without_fork?
closed?
&&
(
forked_source_project_missing?
||
!
source_project
)
closed?
&&
forked_source_project_missing?
end
def
closed_without_source_project?
closed?
&&
!
source_project
end
def
forked_source_project_missing?
...
...
app/views/projects/merge_requests/_discussion.html.haml
View file @
31c37c6c
...
...
@@ -2,7 +2,7 @@
-
if
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
-
if
@merge_request
.
open?
=
link_to
'Close merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-close close-mr-link js-note-target-close"
,
title:
"Close merge request"
,
data:
{
original_text:
"Close merge request"
,
alternative_text:
"Comment & close merge request"
}
-
if
@merge_request
.
closed
?
-
unless
@merge_request
.
open?
||
@merge_request
.
closed_without_fork
?
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
%comment-and-resolve-btn
{
"inline-template"
=>
true
,
":discussion-id"
=>
""
}
%button
.btn.btn-nr.btn-default.append-right-10.js-comment-resolve-button
{
"v-if"
=>
"showButton"
,
type:
"submit"
,
data:
{
namespace_path:
"#{@merge_request.project.namespace.path}"
,
project_path:
"#{@merge_request.project.path}"
}
}
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
31c37c6c
...
...
@@ -29,17 +29,19 @@
%ul
.dropdown-menu.dropdown-menu-align-right
%li
=
link_to
"Email Patches"
,
merge_request_path
(
@merge_request
,
format: :patch
)
%li
=
link_to
"Plain Diff"
,
merge_request_path
(
@merge_request
,
format: :diff
)
.normal
%span
Request to merge
%span
.label-branch
=
source_branch_with_namespace
(
@merge_request
)
%span
into
%span
.label-branch
=
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
)
-
if
@merge_request
.
open?
&&
@merge_request
.
diverged_from_target_branch?
%span
(
#{
pluralize
(
@merge_request
.
diverged_commits_count
,
'commit'
)
}
behind)
-
unless
@merge_request
.
closed_without_fork?
.normal
%span
Request to merge
%span
.label-branch
=
source_branch_with_namespace
(
@merge_request
)
%span
into
%span
.label-branch
=
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
)
-
if
@merge_request
.
open?
&&
@merge_request
.
diverged_from_target_branch?
%span
(
#{
pluralize
(
@merge_request
.
diverged_commits_count
,
'commit'
)
}
behind)
=
render
"projects/merge_requests/show/how_to_merge"
=
render
"projects/merge_requests/widget/show.html.haml"
-
unless
@merge_request
.
closed_without_source_project?
=
render
"projects/merge_requests/show/how_to_merge"
=
render
"projects/merge_requests/widget/show.html.haml"
-
if
@merge_request
.
source_branch_exists?
&&
@merge_request
.
mergeable?
&&
@merge_request
.
can_be_merged_by?
(
current_user
)
.light.prepend-top-default.append-bottom-default
...
...
@@ -53,10 +55,11 @@
=
link_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#notes'
,
action:
'notes'
,
toggle:
'tab'
}
do
Discussion
%span
.badge
=
@merge_request
.
mr_and_commit_notes
.
user
.
count
%li
.commits-tab
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
Commits
%span
.badge
=
@commits_count
-
unless
@merge_request
.
closed_without_source_project?
%li
.commits-tab
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
Commits
%span
.badge
=
@commits_count
-
if
@pipeline
%li
.pipelines-tab
=
link_to
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#pipelines'
,
action:
'pipelines'
,
toggle:
'tab'
}
do
...
...
spec/controllers/projects_controller_spec.rb
View file @
31c37c6c
...
...
@@ -186,9 +186,9 @@ describe ProjectsController do
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
fork_project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
fork_project
,
target_project:
project
)
end
it
"closes all related merge requests"
do
...
...
Alain Takoudjou
@alain.takoudjou
mentioned in commit
e6f515ec
·
May 03, 2017
mentioned in commit
e6f515ec
mentioned in commit e6f515ecbed85b204e8f7bc9934b0bf208a0ea4c
Toggle commit list
Alain Takoudjou
@alain.takoudjou
mentioned in commit
b6c85997
·
May 03, 2017
mentioned in commit
b6c85997
mentioned in commit b6c859974307b71a82544cb137196b1bcd7ef7ef
Toggle commit list
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