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
Boxiang Sun
gitlab-ce
Commits
31c37c6c
Commit
31c37c6c
authored
Sep 02, 2016
by
Katarzyna Kobierska
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
...
@@ -313,7 +313,11 @@ class MergeRequest < ActiveRecord::Base
end
end
def
closed_without_fork?
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
end
def
forked_source_project_missing?
def
forked_source_project_missing?
...
...
app/views/projects/merge_requests/_discussion.html.haml
View file @
31c37c6c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
-
if
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
-
if
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
-
if
@merge_request
.
open?
-
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"
}
=
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"
}
=
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"
=>
""
}
%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}"
}
}
%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 @@
...
@@ -29,17 +29,19 @@
%ul
.dropdown-menu.dropdown-menu-align-right
%ul
.dropdown-menu.dropdown-menu-align-right
%li
=
link_to
"Email Patches"
,
merge_request_path
(
@merge_request
,
format: :patch
)
%li
=
link_to
"Email Patches"
,
merge_request_path
(
@merge_request
,
format: :patch
)
%li
=
link_to
"Plain Diff"
,
merge_request_path
(
@merge_request
,
format: :diff
)
%li
=
link_to
"Plain Diff"
,
merge_request_path
(
@merge_request
,
format: :diff
)
.normal
-
unless
@merge_request
.
closed_without_fork?
%span
Request to merge
.normal
%span
.label-branch
=
source_branch_with_namespace
(
@merge_request
)
%span
Request to merge
%span
into
%span
.label-branch
=
source_branch_with_namespace
(
@merge_request
)
%span
.label-branch
%span
into
=
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
)
%span
.label-branch
-
if
@merge_request
.
open?
&&
@merge_request
.
diverged_from_target_branch?
=
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
)
%span
(
#{
pluralize
(
@merge_request
.
diverged_commits_count
,
'commit'
)
}
behind)
-
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"
-
unless
@merge_request
.
closed_without_source_project?
=
render
"projects/merge_requests/widget/show.html.haml"
=
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
)
-
if
@merge_request
.
source_branch_exists?
&&
@merge_request
.
mergeable?
&&
@merge_request
.
can_be_merged_by?
(
current_user
)
.light.prepend-top-default.append-bottom-default
.light.prepend-top-default.append-bottom-default
...
@@ -53,10 +55,11 @@
...
@@ -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
=
link_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#notes'
,
action:
'notes'
,
toggle:
'tab'
}
do
Discussion
Discussion
%span
.badge
=
@merge_request
.
mr_and_commit_notes
.
user
.
count
%span
.badge
=
@merge_request
.
mr_and_commit_notes
.
user
.
count
%li
.commits-tab
-
unless
@merge_request
.
closed_without_source_project?
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
%li
.commits-tab
Commits
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
%span
.badge
=
@commits_count
Commits
%span
.badge
=
@commits_count
-
if
@pipeline
-
if
@pipeline
%li
.pipelines-tab
%li
.pipelines-tab
=
link_to
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#pipelines'
,
action:
'pipelines'
,
toggle:
'tab'
}
do
=
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
...
@@ -186,9 +186,9 @@ describe ProjectsController do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:merge_request
)
do
let
(
:merge_request
)
do
create
(
:merge_request
,
create
(
:merge_request
,
source_project:
fork_project
,
source_project:
fork_project
,
target_project:
project
)
target_project:
project
)
end
end
it
"closes all related merge requests"
do
it
"closes all related merge requests"
do
...
...
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