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
5cce750e
Commit
5cce750e
authored
Jun 02, 2021
by
Vitaly Slobodin
Committed by
Fabio Pitino
Jun 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show CC validation alert if the corresponding user setting is true
parent
8aa0d876
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
2 deletions
+60
-2
app/views/projects/pipelines/show.html.haml
app/views/projects/pipelines/show.html.haml
+1
-1
ee/app/helpers/ee/ci/pipelines_helper.rb
ee/app/helpers/ee/ci/pipelines_helper.rb
+13
-0
ee/spec/features/projects/pipelines/pipeline_spec.rb
ee/spec/features/projects/pipelines/pipeline_spec.rb
+2
-1
ee/spec/helpers/ee/ci/pipelines_helper_spec.rb
ee/spec/helpers/ee/ci/pipelines_helper_spec.rb
+44
-0
No files found.
app/views/projects/pipelines/show.html.haml
View file @
5cce750e
...
...
@@ -12,7 +12,7 @@
.js-pipeline-container
{
data:
{
controller_action:
"#{controller.action_name}"
}
}
#js-pipeline-header-vue
.pipeline-header-container
{
data:
{
full_path:
@project
.
full_path
,
pipeline_iid:
@pipeline
.
iid
,
pipeline_id:
@pipeline
.
id
,
pipelines_path:
project_pipelines_path
(
@project
)
}
}
-
if
@pipeline
.
failed?
&&
@pipeline
.
user_not_verified?
-
if
Gitlab
.
com?
&&
show_cc_validation_alert?
(
@pipeline
)
#js-cc-validation-required-alert
-
if
@pipeline
.
commit
.
present?
...
...
ee/app/helpers/ee/ci/pipelines_helper.rb
0 → 100644
View file @
5cce750e
# frozen_string_literal: true
module
EE
module
Ci
module
PipelinesHelper
def
show_cc_validation_alert?
(
pipeline
)
return
false
if
pipeline
.
user
.
blank?
||
current_user
!=
pipeline
.
user
pipeline
.
user_not_verified?
&&
!
pipeline
.
user
.
has_required_credit_card_to_run_pipelines?
(
pipeline
.
project
)
end
end
end
end
ee/spec/features/projects/pipelines/pipeline_spec.rb
View file @
5cce750e
...
...
@@ -171,7 +171,8 @@ RSpec.describe 'Pipeline', :js do
ref:
'master'
,
status:
'failed'
,
failure_reason:
'user_not_verified'
,
sha:
project
.
commit
.
id
sha:
project
.
commit
.
id
,
user:
user
)
end
...
...
ee/spec/helpers/ee/ci/pipelines_helper_spec.rb
0 → 100644
View file @
5cce750e
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
EE
::
Ci
::
PipelinesHelper
do
describe
'#show_cc_validation_alert?'
do
using
RSpec
::
Parameterized
::
TableSyntax
subject
(
:show_cc_validation_alert?
)
{
helper
.
show_cc_validation_alert?
(
pipeline
)
}
let
(
:current_user
)
{
instance_double
(
User
)
}
let
(
:project
)
{
instance_double
(
Project
)
}
let
(
:pipeline
)
{
instance_double
(
Ci
::
Pipeline
,
user_not_verified?:
user_not_verified?
,
project:
project
,
user:
current_user
)
}
where
(
:user_not_verified?
,
:has_required_cc?
,
:result
)
do
true
|
false
|
true
false
|
true
|
false
true
|
true
|
false
false
|
false
|
false
end
with_them
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
current_user
)
allow
(
current_user
).
to
receive
(
:has_required_credit_card_to_run_pipelines?
)
.
with
(
project
)
.
and_return
(
has_required_cc?
)
end
it
{
is_expected
.
to
eq
(
result
)
}
end
context
'without current user'
do
let
(
:pipeline
)
{
instance_double
(
Ci
::
Pipeline
,
user:
nil
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
it
{
is_expected
.
to
be_falsy
}
end
end
end
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