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
9d8394cc
Commit
9d8394cc
authored
Apr 30, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
06493527
a2543ee2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
15 deletions
+103
-15
app/presenters/ci/pipeline_presenter.rb
app/presenters/ci/pipeline_presenter.rb
+2
-10
app/presenters/merge_request_presenter.rb
app/presenters/merge_request_presenter.rb
+16
-0
changelogs/unreleased/fix-ref-text-of-mr-pipelines.yml
changelogs/unreleased/fix-ref-text-of-mr-pipelines.yml
+6
-0
spec/features/projects/pipelines/pipeline_spec.rb
spec/features/projects/pipelines/pipeline_spec.rb
+33
-5
spec/presenters/merge_request_presenter_spec.rb
spec/presenters/merge_request_presenter_spec.rb
+46
-0
No files found.
app/presenters/ci/pipeline_presenter.rb
View file @
9d8394cc
...
...
@@ -63,19 +63,11 @@ module Ci
end
def
link_to_merge_request_source_branch
return
unless
merge_request_presenter
link_to
(
merge_request_presenter
.
source_branch
,
merge_request_presenter
.
source_branch_commits_path
,
class:
'ref-name'
)
merge_request_presenter
&
.
source_branch_link
end
def
link_to_merge_request_target_branch
return
unless
merge_request_presenter
link_to
(
merge_request_presenter
.
target_branch
,
merge_request_presenter
.
target_branch_commits_path
,
class:
'ref-name'
)
merge_request_presenter
&
.
target_branch_link
end
private
...
...
app/presenters/merge_request_presenter.rb
View file @
9d8394cc
...
...
@@ -216,6 +216,22 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
help_page_path
(
'ci/merge_request_pipelines/index.md'
)
end
def
source_branch_link
if
source_branch_exists?
link_to
(
source_branch
,
source_branch_commits_path
,
class:
'ref-name'
)
else
content_tag
(
:span
,
source_branch
,
class:
'ref-name'
)
end
end
def
target_branch_link
if
target_branch_exists?
link_to
(
target_branch
,
target_branch_commits_path
,
class:
'ref-name'
)
else
content_tag
(
:span
,
target_branch
,
class:
'ref-name'
)
end
end
private
def
cached_can_be_reverted?
...
...
changelogs/unreleased/fix-ref-text-of-mr-pipelines.yml
0 → 100644
View file @
9d8394cc
---
title
:
Fix pipelines for merge requests does not show pipeline page when source branch
is removed
merge_request
:
27803
author
:
type
:
fixed
spec/features/projects/pipelines/pipeline_spec.rb
View file @
9d8394cc
...
...
@@ -331,11 +331,9 @@ describe 'Pipeline', :js do
merge_request
.
all_pipelines
.
last
end
before
do
it
'shows the pipeline information'
do
visit_pipeline
end
it
'shows the pipeline information'
do
within
'.pipeline-info'
do
expect
(
page
).
to
have_content
(
"
#{
pipeline
.
statuses
.
count
}
jobs "
\
"for !
#{
merge_request
.
iid
}
"
\
...
...
@@ -347,6 +345,21 @@ describe 'Pipeline', :js do
end
end
context
'when source branch does not exist'
do
before
do
project
.
repository
.
rm_branch
(
user
,
merge_request
.
source_branch
)
end
it
'does not link to the source branch commit path'
do
visit_pipeline
within
'.pipeline-info'
do
expect
(
page
).
not_to
have_link
(
merge_request
.
source_branch
)
expect
(
page
).
to
have_content
(
merge_request
.
source_branch
)
end
end
end
context
'when source project is a forked project'
do
let
(
:source_project
)
{
fork_project
(
project
,
user
,
repository:
true
)
}
...
...
@@ -386,11 +399,11 @@ describe 'Pipeline', :js do
before
do
pipeline
.
update
(
user:
user
)
visit_pipeline
end
it
'shows the pipeline information'
do
visit_pipeline
within
'.pipeline-info'
do
expect
(
page
).
to
have_content
(
"
#{
pipeline
.
statuses
.
count
}
jobs "
\
"for !
#{
merge_request
.
iid
}
"
\
...
...
@@ -405,6 +418,21 @@ describe 'Pipeline', :js do
end
end
context
'when target branch does not exist'
do
before
do
project
.
repository
.
rm_branch
(
user
,
merge_request
.
target_branch
)
end
it
'does not link to the target branch commit path'
do
visit_pipeline
within
'.pipeline-info'
do
expect
(
page
).
not_to
have_link
(
merge_request
.
target_branch
)
expect
(
page
).
to
have_content
(
merge_request
.
target_branch
)
end
end
end
context
'when source project is a forked project'
do
let
(
:source_project
)
{
fork_project
(
project
,
user
,
repository:
true
)
}
...
...
spec/presenters/merge_request_presenter_spec.rb
View file @
9d8394cc
...
...
@@ -439,6 +439,52 @@ describe MergeRequestPresenter do
end
end
describe
'#source_branch_link'
do
subject
{
presenter
.
source_branch_link
}
let
(
:presenter
)
{
described_class
.
new
(
resource
,
current_user:
user
)
}
context
'when source branch exists'
do
it
'returns link'
do
allow
(
resource
).
to
receive
(
:source_branch_exists?
)
{
true
}
is_expected
.
to
eq
(
"<a class=
\"
ref-name
\"
href=
\"
#{
presenter
.
source_branch_commits_path
}
\"
>
#{
presenter
.
source_branch
}
</a>"
)
end
end
context
'when source branch does not exist'
do
it
'returns text'
do
allow
(
resource
).
to
receive
(
:source_branch_exists?
)
{
false
}
is_expected
.
to
eq
(
"<span class=
\"
ref-name
\"
>
#{
presenter
.
source_branch
}
</span>"
)
end
end
end
describe
'#target_branch_link'
do
subject
{
presenter
.
target_branch_link
}
let
(
:presenter
)
{
described_class
.
new
(
resource
,
current_user:
user
)
}
context
'when target branch exists'
do
it
'returns link'
do
allow
(
resource
).
to
receive
(
:target_branch_exists?
)
{
true
}
is_expected
.
to
eq
(
"<a class=
\"
ref-name
\"
href=
\"
#{
presenter
.
target_branch_commits_path
}
\"
>
#{
presenter
.
target_branch
}
</a>"
)
end
end
context
'when target branch does not exist'
do
it
'returns text'
do
allow
(
resource
).
to
receive
(
:target_branch_exists?
)
{
false
}
is_expected
.
to
eq
(
"<span class=
\"
ref-name
\"
>
#{
presenter
.
target_branch
}
</span>"
)
end
end
end
describe
'#source_branch_with_namespace_link'
do
subject
do
described_class
.
new
(
resource
,
current_user:
user
).
source_branch_with_namespace_link
...
...
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