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
de2c5422
Commit
de2c5422
authored
Aug 31, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
56b66f21
dc7a66f1
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
402 additions
and
200 deletions
+402
-200
app/assets/javascripts/graphql_shared/constants.js
app/assets/javascripts/graphql_shared/constants.js
+1
-0
app/assets/javascripts/runner/runner_search_utils.js
app/assets/javascripts/runner/runner_search_utils.js
+0
-1
app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js
...d/components/filtered_search_bar/filtered_search_utils.js
+5
-4
doc/administration/operations/moving_repositories.md
doc/administration/operations/moving_repositories.md
+5
-0
doc/ci/environments/incremental_rollouts.md
doc/ci/environments/incremental_rollouts.md
+1
-1
ee/app/assets/javascripts/analytics/code_review_analytics/code_review_analytics_bundle.js
...ics/code_review_analytics/code_review_analytics_bundle.js
+3
-1
ee/app/assets/javascripts/analytics/cycle_analytics/index.js
ee/app/assets/javascripts/analytics/cycle_analytics/index.js
+3
-1
ee/app/assets/javascripts/analytics/merge_request_analytics/index.js
...ts/javascripts/analytics/merge_request_analytics/index.js
+3
-1
ee/app/assets/javascripts/security_dashboard/graphql/fragments/note.fragment.graphql
...ecurity_dashboard/graphql/fragments/note.fragment.graphql
+17
-0
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_create.mutation.graphql
..._dashboard/graphql/mutations/note_create.mutation.graphql
+22
-0
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_destroy.mutation.graphql
...dashboard/graphql/mutations/note_destroy.mutation.graphql
+1
-1
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_update.mutation.graphql
..._dashboard/graphql/mutations/note_update.mutation.graphql
+10
-0
ee/app/assets/javascripts/vulnerabilities/components/footer.vue
.../assets/javascripts/vulnerabilities/components/footer.vue
+4
-2
ee/app/assets/javascripts/vulnerabilities/components/history_comment.vue
...avascripts/vulnerabilities/components/history_comment.vue
+66
-38
ee/app/assets/javascripts/vulnerabilities/components/history_entry.vue
.../javascripts/vulnerabilities/components/history_entry.vue
+5
-12
ee/app/assets/javascripts/vulnerabilities/helpers.js
ee/app/assets/javascripts/vulnerabilities/helpers.js
+22
-0
ee/spec/frontend/vulnerabilities/footer_spec.js
ee/spec/frontend/vulnerabilities/footer_spec.js
+0
-2
ee/spec/frontend/vulnerabilities/history_comment_spec.js
ee/spec/frontend/vulnerabilities/history_comment_spec.js
+212
-120
ee/spec/frontend/vulnerabilities/history_entry_spec.js
ee/spec/frontend/vulnerabilities/history_entry_spec.js
+4
-7
ee/spec/frontend/vulnerabilities/vulnerability_spec.js
ee/spec/frontend/vulnerabilities/vulnerability_spec.js
+10
-8
spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_utils_spec.js
...ponents/filtered_search_bar/filtered_search_utils_spec.js
+8
-1
No files found.
app/assets/javascripts/graphql_shared/constants.js
View file @
de2c5422
...
...
@@ -14,3 +14,4 @@ export const TYPE_SITE_PROFILE = 'DastSiteProfile';
export
const
TYPE_USER
=
'
User
'
;
export
const
TYPE_VULNERABILITY
=
'
Vulnerability
'
;
export
const
TYPE_NOTE
=
'
Note
'
;
export
const
TYPE_DISCUSSION
=
'
Discussion
'
;
app/assets/javascripts/runner/runner_search_utils.js
View file @
de2c5422
...
...
@@ -43,7 +43,6 @@ export const fromUrlQueryToSearch = (query = window.location.search) => {
urlQueryToFilter
(
query
,
{
filterNamesAllowList
:
[
PARAM_KEY_STATUS
,
PARAM_KEY_RUNNER_TYPE
,
PARAM_KEY_TAG
],
filteredSearchTermKey
:
PARAM_KEY_SEARCH
,
legacySpacesDecode
:
false
,
}),
),
sort
:
params
[
PARAM_KEY_SORT
]
||
DEFAULT_SORT
,
...
...
app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js
View file @
de2c5422
...
...
@@ -177,12 +177,13 @@ function filteredSearchTermValue(value) {
* @param {Object} options
* @param {String} [options.filteredSearchTermKey] if set, a FILTERED_SEARCH_TERM filter is created to this parameter. `'search'` is suggested
* @param {String[]} [options.filterNamesAllowList] if set, only this list of filters names is mapped
* @param {Boolean} [options.legacySpacesDecode] if set
, plus symbols (+) are not encoded as spaces. `false` is suggested
* @param {Boolean} [options.legacySpacesDecode] if set
to true, plus symbols (+) are not encoded as spaces.
* @return {Object} filter object with filter names and their values
*/
export
function
urlQueryToFilter
(
query
=
''
,
options
=
{})
{
const
{
filteredSearchTermKey
,
filterNamesAllowList
,
legacySpacesDecode
=
true
}
=
options
;
export
function
urlQueryToFilter
(
query
=
''
,
{
filteredSearchTermKey
,
filterNamesAllowList
,
legacySpacesDecode
=
false
}
=
{},
)
{
const
filters
=
queryToObject
(
query
,
{
gatherArrays
:
true
,
legacySpacesDecode
});
return
Object
.
keys
(
filters
).
reduce
((
memo
,
key
)
=>
{
const
value
=
filters
[
key
];
...
...
doc/administration/operations/moving_repositories.md
View file @
de2c5422
...
...
@@ -39,6 +39,11 @@ WARNING:
To move repositories into a
[
Gitaly Cluster
](
../gitaly/index.md#gitaly-cluster
)
in GitLab versions
13.
12 to 14.1, you must
[
enable the `gitaly_replicate_repository_direct_fetch` feature flag
](
../feature_flags.md
)
.
WARNING:
Repositories can be
**permanently deleted**
by a call to
`/projects/:project_id/repository_storage_moves`
that attempts to move a project already stored in a Gitaly Cluster back into that cluster.
See
[
this issue for more details
](
https://gitlab.com/gitlab-org/gitaly/-/issues/3752
)
.
Each repository is made read-only for the duration of the move. The repository is not writable
until the move has completed.
...
...
doc/ci/environments/incremental_rollouts.md
View file @
de2c5422
...
...
@@ -43,7 +43,7 @@ number of pods that are defined for the deployment, which are configured when th
cluster is created.
For example, if your application has 10 pods and a 10% rollout job runs, the new instance of the
application is deployed to a single pod while the re
maining nine are present the previous instance
.
application is deployed to a single pod while the re
st of the pods show the previous instance of the application
.
First we
[
define the template as manual
](
https://gitlab.com/gl-release/incremental-rollout-example/blob/master/.gitlab-ci.yml#L100-103
)
:
...
...
ee/app/assets/javascripts/analytics/code_review_analytics/code_review_analytics_bundle.js
View file @
de2c5422
...
...
@@ -20,7 +20,9 @@ export default () => {
labelsEndpoint
:
labelsPath
,
projectEndpoint
:
projectPath
,
});
const
{
milestone_title
=
null
,
label_name
=
[]
}
=
urlQueryToFilter
(
window
.
location
.
search
);
const
{
milestone_title
=
null
,
label_name
=
[]
}
=
urlQueryToFilter
(
window
.
location
.
search
,
{
legacySpacesDecode
:
true
,
});
store
.
dispatch
(
'
filters/initialize
'
,
{
selectedMilestone
:
milestone_title
,
selectedLabelList
:
label_name
,
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/index.js
View file @
de2c5422
...
...
@@ -28,7 +28,9 @@ export default () => {
sort
,
direction
,
page
,
}
=
urlQueryToFilter
(
window
.
location
.
search
);
}
=
urlQueryToFilter
(
window
.
location
.
search
,
{
legacySpacesDecode
:
true
,
});
store
.
dispatch
(
'
initializeCycleAnalytics
'
,
{
...
initialData
,
...
...
ee/app/assets/javascripts/analytics/merge_request_analytics/index.js
View file @
de2c5422
...
...
@@ -35,7 +35,9 @@ export default () => {
author_username
=
null
,
milestone_title
=
null
,
label_name
=
[],
}
=
urlQueryToFilter
(
window
.
location
.
search
);
}
=
urlQueryToFilter
(
window
.
location
.
search
,
{
legacySpacesDecode
:
true
,
});
store
.
dispatch
(
'
filters/initialize
'
,
{
selectedSourceBranch
:
source_branch_name
,
selectedTargetBranch
:
target_branch_name
,
...
...
ee/app/assets/javascripts/security_dashboard/graphql/fragments/note.fragment.graphql
0 → 100644
View file @
de2c5422
fragment
SecurityDashboardNote
on
Note
{
id
system
body
bodyHtml
updatedAt
systemNoteIconName
userPermissions
{
adminNote
}
author
{
id
name
webPath
username
}
}
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_create.mutation.graphql
0 → 100644
View file @
de2c5422
#import "../fragments/note.fragment.graphql"
mutation
securityDashboardCreateNote
(
$noteableId
:
NoteableID
!
$discussionId
:
DiscussionID
$confidential
:
Boolean
$body
:
String
!
)
{
createNote
(
input
:
{
noteableId
:
$noteableId
body
:
$body
confidential
:
$confidential
discussionId
:
$discussionId
}
)
{
errors
note
{
...
SecurityDashboardNote
}
}
}
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_de
lete
.mutation.graphql
→
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_de
stroy
.mutation.graphql
View file @
de2c5422
mutation
(
$id
:
ID
!)
{
mutation
securityDashboardDestroyNote
(
$id
:
ID
!)
{
destroyNote
(
input
:
{
id
:
$id
})
{
errors
note
{
...
...
ee/app/assets/javascripts/security_dashboard/graphql/mutations/note_update.mutation.graphql
0 → 100644
View file @
de2c5422
#import "../fragments/note.fragment.graphql"
mutation
securityDashboardUpdateNote
(
$id
:
NoteID
!,
$confidential
:
Boolean
,
$body
:
String
!)
{
updateNote
(
input
:
{
id
:
$id
,
body
:
$body
,
confidential
:
$confidential
})
{
errors
note
{
...
SecurityDashboardNote
}
}
}
ee/app/assets/javascripts/vulnerabilities/components/footer.vue
View file @
de2c5422
...
...
@@ -71,7 +71,7 @@ export default {
this
.
createNotesPoll
();
if
(
!
Visibility
.
hidden
())
{
this
.
poll
.
makeRequest
();
this
.
fetchDiscussions
();
}
Visibility
.
change
(()
=>
{
...
...
@@ -148,6 +148,9 @@ export default {
}
},
methods
:
{
fetchDiscussions
()
{
return
this
.
poll
.
makeRequest
();
},
findDiscussion
(
id
)
{
return
this
.
discussions
.
find
((
d
)
=>
d
.
id
===
id
);
},
...
...
@@ -253,7 +256,6 @@ export default {
v-for=
"discussion in discussions"
:key=
"discussion.id"
:discussion=
"discussion"
:notes-url=
"vulnerability.notesUrl"
/>
</ul>
</div>
...
...
ee/app/assets/javascripts/vulnerabilities/components/history_comment.vue
View file @
de2c5422
<
script
>
import
{
GlButton
,
GlSafeHtmlDirective
as
SafeHtml
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
deleteNoteMutation
from
'
ee/security_dashboard/graphql/mutations/note_delete.mutation.graphql
'
;
import
createNoteMutation
from
'
ee/security_dashboard/graphql/mutations/note_create.mutation.graphql
'
;
import
destroyNoteMutation
from
'
ee/security_dashboard/graphql/mutations/note_destroy.mutation.graphql
'
;
import
updateNoteMutation
from
'
ee/security_dashboard/graphql/mutations/note_update.mutation.graphql
'
;
import
EventItem
from
'
ee/vue_shared/security_reports/components/event_item.vue
'
;
import
createFlash
from
'
~/flash
'
;
import
{
TYPE_NOTE
}
from
'
~/graphql_shared/constants
'
;
import
{
TYPE_NOTE
,
TYPE_DISCUSSION
,
TYPE_VULNERABILITY
}
from
'
~/graphql_shared/constants
'
;
import
{
convertToGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
{
normalizeGraphQLNote
}
from
'
../helpers
'
;
import
HistoryCommentEditor
from
'
./history_comment_editor.vue
'
;
export
default
{
...
...
@@ -21,6 +23,8 @@ export default {
SafeHtml
,
},
inject
:
[
'
vulnerabilityId
'
],
props
:
{
comment
:
{
type
:
Object
,
...
...
@@ -32,10 +36,6 @@ export default {
required
:
false
,
default
:
undefined
,
},
notesUrl
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
...
...
@@ -63,7 +63,7 @@ export default {
];
},
initialComment
()
{
return
this
.
comment
&&
this
.
comment
.
note
;
return
this
.
comment
?
.
note
;
},
canEditComment
()
{
return
this
.
comment
.
currentUser
?.
canEdit
;
...
...
@@ -85,51 +85,79 @@ export default {
showCommentInput
()
{
this
.
isEditingComment
=
true
;
},
getSaveConfig
(
note
)
{
const
isUpdatingComment
=
Boolean
(
this
.
comment
);
const
method
=
isUpdatingComment
?
'
put
'
:
'
post
'
;
const
url
=
isUpdatingComment
?
this
.
comment
.
path
:
this
.
notesUrl
;
const
data
=
{
note
:
{
note
}
};
const
emitName
=
isUpdatingComment
?
'
onCommentUpdated
'
:
'
onCommentAdded
'
;
// If we're saving a new comment, use the discussion ID in the request data.
if
(
!
isUpdatingComment
)
{
data
.
in_reply_to_discussion_id
=
this
.
discussionId
;
async
insertComment
(
body
)
{
const
{
data
}
=
await
this
.
$apollo
.
mutate
({
mutation
:
createNoteMutation
,
variables
:
{
noteableId
:
convertToGraphQLId
(
TYPE_VULNERABILITY
,
this
.
vulnerabilityId
),
discussionId
:
convertToGraphQLId
(
TYPE_DISCUSSION
,
this
.
discussionId
),
body
,
},
});
const
{
note
,
errors
}
=
data
.
createNote
;
if
(
errors
?.
length
>
0
)
{
throw
errors
;
}
return
{
method
,
url
,
data
,
emitName
}
;
this
.
$emit
(
'
onCommentAdded
'
,
normalizeGraphQLNote
(
note
))
;
},
saveComment
(
note
)
{
async
updateComment
(
body
)
{
const
{
data
}
=
await
this
.
$apollo
.
mutate
({
mutation
:
updateNoteMutation
,
variables
:
{
id
:
convertToGraphQLId
(
TYPE_NOTE
,
this
.
comment
.
id
),
body
,
},
});
const
{
note
,
errors
}
=
data
.
updateNote
;
if
(
errors
?.
length
>
0
)
{
throw
errors
;
}
this
.
cancelEditingComment
();
this
.
$emit
(
'
onCommentUpdated
'
,
normalizeGraphQLNote
(
note
));
},
async
saveComment
(
body
)
{
this
.
isSavingComment
=
true
;
const
{
method
,
url
,
data
,
emitName
}
=
this
.
getSaveConfig
(
note
);
// note: this direct API call will be replaced when migrating the vulnerability details page to GraphQL
// related epic: https://gitlab.com/groups/gitlab-org/-/epics/3657
axios
({
method
,
url
,
data
})
.
then
(({
data
:
responseData
})
=>
{
this
.
isEditingComment
=
false
;
this
.
$emit
(
emitName
,
{
response
:
responseData
,
comment
:
this
.
comment
});
})
.
catch
(()
=>
{
createFlash
({
message
:
s__
(
'
VulnerabilityManagement|Something went wrong while trying to save the comment. Please try again later.
'
,
),
});
const
isUpdatingComment
=
Boolean
(
this
.
comment
);
try
{
if
(
isUpdatingComment
)
{
await
this
.
updateComment
(
body
);
}
else
{
await
this
.
insertComment
(
body
);
}
}
catch
{
createFlash
({
message
:
s__
(
'
VulnerabilityManagement|Something went wrong while trying to save the comment. Please try again later.
'
,
),
});
}
this
.
isSavingComment
=
false
;
},
async
deleteComment
()
{
this
.
isDeletingComment
=
true
;
try
{
await
this
.
$apollo
.
mutate
({
mutation
:
de
lete
NoteMutation
,
const
{
data
}
=
await
this
.
$apollo
.
mutate
({
mutation
:
de
stroy
NoteMutation
,
variables
:
{
id
:
convertToGraphQLId
(
TYPE_NOTE
,
this
.
comment
.
id
),
},
});
if
(
data
.
errors
?.
length
>
0
)
{
throw
data
.
errors
;
}
this
.
$emit
(
'
onCommentDeleted
'
,
this
.
comment
);
}
catch
(
e
)
{
}
catch
{
createFlash
({
message
:
s__
(
'
VulnerabilityManagement|Something went wrong while trying to delete the comment. Please try again later.
'
,
...
...
ee/app/assets/javascripts/vulnerabilities/components/history_entry.vue
View file @
de2c5422
<
script
>
import
EventItem
from
'
ee/vue_shared/security_reports/components/event_item.vue
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
HistoryComment
from
'
./history_comment.vue
'
;
export
default
{
...
...
@@ -10,10 +9,6 @@ export default {
type
:
Object
,
required
:
true
,
},
notesUrl
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
...
...
@@ -34,14 +29,14 @@ export default {
},
},
methods
:
{
addComment
(
{
response
}
)
{
this
.
notes
.
push
(
convertObjectPropsToCamelCase
(
response
)
);
addComment
(
note
)
{
this
.
notes
.
push
(
note
);
},
updateComment
(
{
response
,
comment
}
)
{
const
index
=
this
.
notes
.
indexOf
(
comment
);
updateComment
(
note
)
{
const
index
=
this
.
notes
.
findIndex
((
n
)
=>
Number
(
n
.
id
)
===
note
.
id
);
if
(
index
>
-
1
)
{
this
.
notes
.
splice
(
index
,
1
,
{
...
comment
,
...
convertObjectPropsToCamelCase
(
response
)
}
);
this
.
notes
.
splice
(
index
,
1
,
note
);
}
},
removeComment
(
comment
)
{
...
...
@@ -76,7 +71,6 @@ export default {
ref=
"existingComment"
:comment=
"comment"
:discussion-id=
"discussion.replyId"
:notes-url=
"notesUrl"
@
onCommentUpdated=
"updateComment"
@
onCommentDeleted=
"removeComment"
/>
...
...
@@ -86,7 +80,6 @@ export default {
v-else
ref=
"newComment"
:discussion-id=
"discussion.replyId"
:notes-url=
"notesUrl"
@
onCommentAdded=
"addComment"
/>
</li>
...
...
ee/app/assets/javascripts/vulnerabilities/helpers.js
View file @
de2c5422
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
isAbsolute
,
isSafeURL
}
from
'
~/lib/utils/url_utility
'
;
import
{
REGEXES
,
gidPrefix
,
uidPrefix
}
from
'
./constants
'
;
...
...
@@ -28,6 +29,27 @@ export const getAddRelatedIssueRequestParams = (reference, defaultProjectId) =>
return
{
target_issue_iid
:
issueId
,
target_project_id
:
projectId
};
};
export
const
normalizeGraphQLNote
=
(
note
)
=>
{
if
(
!
note
)
{
return
null
;
}
return
{
...
note
,
id
:
getIdFromGraphQLId
(
note
.
id
),
note
:
note
.
body
,
noteHtml
:
note
.
bodyHtml
,
currentUser
:
{
canEdit
:
note
.
userPermissions
?.
adminNote
,
},
author
:
{
...
note
.
author
,
id
:
getIdFromGraphQLId
(
note
.
author
.
id
),
path
:
note
.
author
.
webPath
,
},
};
};
export
const
normalizeGraphQLVulnerability
=
(
vulnerability
)
=>
{
if
(
!
vulnerability
)
{
return
null
;
...
...
ee/spec/frontend/vulnerabilities/footer_spec.js
View file @
de2c5422
...
...
@@ -141,12 +141,10 @@ describe('Vulnerability Footer', () => {
expect
(
findDiscussions
().
at
(
0
).
props
()).
toEqual
({
discussion
:
{
...
discussion1
,
notes
:
[
convertObjectPropsToCamelCase
(
notes
[
0
])]
},
notesUrl
:
vulnerability
.
notesUrl
,
});
expect
(
findDiscussions
().
at
(
1
).
props
()).
toEqual
({
discussion
:
{
...
discussion2
,
notes
:
[
convertObjectPropsToCamelCase
(
notes
[
1
])]
},
notesUrl
:
vulnerability
.
notesUrl
,
});
});
...
...
ee/spec/frontend/vulnerabilities/history_comment_spec.js
View file @
de2c5422
This diff is collapsed.
Click to expand it.
ee/spec/frontend/vulnerabilities/history_entry_spec.js
View file @
de2c5422
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
EventItem
from
'
ee/vue_shared/security_reports/components/event_item.vue
'
;
import
HistoryEntry
from
'
ee/vulnerabilities/components/history_entry.vue
'
;
import
{
convertObjectPropsToSnakeCase
}
from
'
~/lib/utils/common_utils
'
;
describe
(
'
History Entry
'
,
()
=>
{
let
wrapper
;
...
...
@@ -84,9 +83,7 @@ describe('History Entry', () => {
it
(
'
adds a new comment correctly
'
,
async
()
=>
{
createWrapper
(
systemNote
);
newComment
().
vm
.
$emit
(
'
onCommentAdded
'
,
{
response
:
convertObjectPropsToSnakeCase
(
commentNote
),
});
newComment
().
vm
.
$emit
(
'
onCommentAdded
'
,
commentNote
);
await
wrapper
.
vm
.
$nextTick
();
...
...
@@ -96,13 +93,13 @@ describe('History Entry', () => {
});
it
(
'
updates an existing comment correctly
'
,
async
()
=>
{
const
response
=
{
note
:
'
new note
'
};
const
updatedNote
=
{
...
commentNote
,
note
:
'
new note
'
};
createWrapper
(
systemNote
,
commentNote
);
commentAt
(
0
).
vm
.
$emit
(
'
onCommentUpdated
'
,
{
response
,
comment
:
commentNote
}
);
commentAt
(
0
).
vm
.
$emit
(
'
onCommentUpdated
'
,
updatedNote
);
await
wrapper
.
vm
.
$nextTick
();
expect
(
commentAt
(
0
).
props
(
'
comment
'
)).
to
Equal
({
...
commentNote
,
note
:
response
.
note
}
);
expect
(
commentAt
(
0
).
props
(
'
comment
'
)).
to
Be
(
updatedNote
);
});
it
(
'
deletes an existing comment correctly
'
,
async
()
=>
{
...
...
ee/spec/frontend/vulnerabilities/vulnerability_spec.js
View file @
de2c5422
...
...
@@ -4,6 +4,7 @@ import Footer from 'ee/vulnerabilities/components/footer.vue';
import
Header
from
'
ee/vulnerabilities/components/header.vue
'
;
import
Main
from
'
ee/vulnerabilities/components/vulnerability.vue
'
;
import
Details
from
'
ee/vulnerabilities/components/vulnerability_details.vue
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
const
mockAxios
=
new
AxiosMockAdapter
();
...
...
@@ -47,6 +48,10 @@ describe('Vulnerability', () => {
propsData
:
{
vulnerability
,
},
stubs
:
{
VulnerabilityHeader
:
stubComponent
(
Header
),
VulnerabilityFooter
:
stubComponent
(
Footer
),
},
});
};
...
...
@@ -77,28 +82,25 @@ describe('Vulnerability', () => {
});
describe
(
'
vulnerability state change event
'
,
()
=>
{
let
fetchDiscussions
;
let
makeRequest
;
let
refreshVulnerability
;
beforeEach
(()
=>
{
fetchDiscussions
=
jest
.
fn
();
refreshVulnerability
=
jest
.
fn
();
findHeader
().
vm
.
refreshVulnerability
=
refreshVulnerability
;
findFooter
().
vm
.
fetchDiscussions
=
fetchDiscussions
;
refreshVulnerability
=
jest
.
spyOn
(
findHeader
().
vm
,
'
refreshVulnerability
'
);
makeRequest
=
jest
.
spyOn
(
findFooter
().
vm
,
'
fetchDiscussions
'
);
});
it
(
'
updates the footer notes when the vulnerbility state was changed
'
,
()
=>
{
findHeader
().
vm
.
$emit
(
'
vulnerability-state-change
'
);
expect
(
fetchDiscussions
).
toHaveBeenCalledTimes
(
1
);
expect
(
makeRequest
).
toHaveBeenCalledTimes
(
1
);
expect
(
refreshVulnerability
).
not
.
toHaveBeenCalled
();
});
it
(
'
updates the header when the footer received a state-change note
'
,
()
=>
{
findFooter
().
vm
.
$emit
(
'
vulnerability-state-change
'
);
expect
(
fetchDiscussions
).
not
.
toHaveBeenCalled
();
expect
(
makeRequest
).
not
.
toHaveBeenCalled
();
expect
(
refreshVulnerability
).
toHaveBeenCalledTimes
(
1
);
});
});
...
...
spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_utils_spec.js
View file @
de2c5422
...
...
@@ -309,7 +309,14 @@ describe('urlQueryToFilter', () => {
{
[
FILTERED_SEARCH_TERM
]:
[{
value
:
'
my
'
},
{
value
:
'
terms
'
}],
},
{
filteredSearchTermKey
:
'
search
'
,
legacySpacesDecode
:
false
},
{
filteredSearchTermKey
:
'
search
'
},
],
[
'
search=my+terms
'
,
{
[
FILTERED_SEARCH_TERM
]:
[{
value
:
'
my+terms
'
}],
},
{
filteredSearchTermKey
:
'
search
'
,
legacySpacesDecode
:
true
},
],
[
'
search=my terms&foo=bar&nop=xxx
'
,
...
...
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