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
e6f515ec
Commit
e6f515ec
authored
Oct 19, 2016
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Add #closed_without_source_project?"
This reverts commit
31c37c6c
. See #23341
parent
c08435e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
57 deletions
+16
-57
app/models/merge_request.rb
app/models/merge_request.rb
+2
-8
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+14
-17
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+0
-32
No files found.
app/models/merge_request.rb
View file @
e6f515ec
...
...
@@ -333,11 +333,7 @@ class MergeRequest < ActiveRecord::Base
end
def
closed_without_fork?
closed?
&&
forked_source_project_missing?
end
def
closed_without_source_project?
closed?
&&
!
source_project
closed?
&&
(
forked_source_project_missing?
||
!
source_project
)
end
def
forked_source_project_missing?
...
...
@@ -348,9 +344,7 @@ class MergeRequest < ActiveRecord::Base
end
def
reopenable?
return
false
if
closed_without_fork?
||
closed_without_source_project?
||
merged?
closed?
source_branch_exists?
&&
closed?
end
def
ensure_merge_request_diff
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
e6f515ec
...
...
@@ -26,19 +26,17 @@
%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
)
-
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)
.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_source_project?
=
render
"projects/merge_requests/show/how_to_merge"
=
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
)
.light.prepend-top-default.append-bottom-default
...
...
@@ -52,11 +50,10 @@
=
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
-
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
%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/models/merge_request_spec.rb
View file @
e6f515ec
...
...
@@ -1274,38 +1274,6 @@ describe MergeRequest, models: true do
end
end
describe
'#closed_without_source_project?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
,
namespace:
user
.
namespace
)
}
let
(
:destroy_service
)
{
Projects
::
DestroyService
.
new
(
fork_project
,
user
)
}
context
'when the merge request is closed'
do
let
(
:closed_merge_request
)
do
create
(
:closed_merge_request
,
source_project:
fork_project
,
target_project:
project
)
end
it
'returns false if the source project exists'
do
expect
(
closed_merge_request
.
closed_without_source_project?
).
to
be_falsey
end
it
'returns true if the source project does not exist'
do
destroy_service
.
execute
closed_merge_request
.
reload
expect
(
closed_merge_request
.
closed_without_source_project?
).
to
be_truthy
end
end
context
'when the merge request is open'
do
it
'returns false'
do
expect
(
subject
.
closed_without_source_project?
).
to
be_falsey
end
end
end
describe
'#reopenable?'
do
context
'when the merge request is closed'
do
it
'returns true'
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