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
bb42f323
Commit
bb42f323
authored
Dec 01, 2021
by
anna_vovchenko
Committed by
Anna Vovchenko
Dec 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the tracking event to contain invalid character
parent
6b3867a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
app/assets/javascripts/ci_variable_list/components/ci_variable_modal.vue
...scripts/ci_variable_list/components/ci_variable_modal.vue
+16
-19
spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js
...end/ci_variable_list/components/ci_variable_modal_spec.js
+4
-3
No files found.
app/assets/javascripts/ci_variable_list/components/ci_variable_modal.vue
View file @
bb42f323
...
...
@@ -60,10 +60,7 @@ export default {
data
()
{
return
{
isTipDismissed
:
Cookies
.
get
(
AWS_TIP_DISMISSED_COOKIE_NAME
)
===
'
true
'
,
isValidationErrorEventSent
:
{
displaysMaskedError
:
false
,
displaysVariableReferenceError
:
false
,
},
validationErrorEventProperty
:
''
,
};
},
computed
:
{
...
...
@@ -162,7 +159,6 @@ export default {
this
.
trackVariableValidationErrors
();
},
deep
:
true
,
immediate
:
true
,
},
},
methods
:
{
...
...
@@ -213,23 +209,24 @@ export default {
}
},
trackVariableValidationErrors
()
{
if
(
this
.
displayMaskedError
&&
!
this
.
isValidationErrorEventSent
.
displaysMaskedError
)
{
this
.
track
(
EVENT_ACTION
,
{
property
:
'
displaysMaskedError
'
});
this
.
isValidationErrorEventSent
.
displaysMaskedError
=
true
;
if
(
this
.
variable
.
secret_value
?.
length
&&
!
this
.
validationErrorEventProperty
)
{
if
(
this
.
displayMaskedError
&&
this
.
maskableRegex
?.
length
)
{
const
supportedChars
=
this
.
maskableRegex
.
replace
(
'
^
'
,
''
).
replace
(
/{
(\d
,
)
}
\$
/
,
''
);
const
regex
=
new
RegExp
(
supportedChars
,
'
g
'
);
const
error
=
this
.
variable
.
secret_value
.
replace
(
regex
,
''
);
this
.
track
(
EVENT_ACTION
,
{
property
:
error
});
this
.
validationErrorEventProperty
=
error
;
}
if
(
this
.
containsVariableReference
)
{
this
.
track
(
EVENT_ACTION
,
{
property
:
'
$
'
});
this
.
validationErrorEventProperty
=
'
$
'
;
}
if
(
this
.
containsVariableReference
&&
!
this
.
isValidationErrorEventSent
.
displaysVariableReferenceError
)
{
this
.
track
(
EVENT_ACTION
,
{
property
:
'
displaysVariableReferenceError
'
});
this
.
isValidationErrorEventSent
.
displaysVariableReferenceError
=
true
;
}
},
resetValidationErrorEvents
()
{
this
.
isValidationErrorEventSent
=
{
displaysMaskedError
:
false
,
displaysVariableReferenceError
:
false
,
};
this
.
validationErrorEventProperty
=
''
;
},
},
};
...
...
spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js
View file @
bb42f323
...
...
@@ -17,8 +17,10 @@ describe('Ci variable modal', () => {
let
store
;
let
trackingSpy
;
const
maskableRegex
=
'
^[a-zA-Z0-9_+=/@:.~-]{8,}$
'
;
const
createComponent
=
(
method
,
options
=
{})
=>
{
store
=
createStore
({
isGroup
:
options
.
isGroup
});
store
=
createStore
({
maskableRegex
,
isGroup
:
options
.
isGroup
});
wrapper
=
method
(
CiVariableModal
,
{
attachTo
:
document
.
body
,
stubs
:
{
...
...
@@ -247,7 +249,7 @@ describe('Ci variable modal', () => {
it
(
'
sends the correct tracking event
'
,
()
=>
{
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
EVENT_ACTION
,
{
label
:
EVENT_LABEL
,
property
:
'
displaysMaskedError
'
,
property
:
'
;
'
,
});
});
});
...
...
@@ -264,7 +266,6 @@ describe('Ci variable modal', () => {
};
createComponent
(
mount
);
store
.
state
.
variable
=
validMaskandKeyVariable
;
store
.
state
.
maskableRegex
=
/^
[
a-zA-Z0-9_+=
/
@:.~-
]{8,}
$/
;
});
it
(
'
does not disable the submit button
'
,
()
=>
{
...
...
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