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
e0919ad3
Commit
e0919ad3
authored
Aug 12, 2021
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix adding or updating vulnerability history comments
Changelog: fixed
parent
6e1e1bf5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
ee/app/assets/javascripts/vulnerabilities/components/history_entry.vue
.../javascripts/vulnerabilities/components/history_entry.vue
+4
-3
ee/spec/frontend/vulnerabilities/history_entry_spec.js
ee/spec/frontend/vulnerabilities/history_entry_spec.js
+14
-9
No files found.
ee/app/assets/javascripts/vulnerabilities/components/history_entry.vue
View file @
e0919ad3
<
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
{
...
...
@@ -33,14 +34,14 @@ export default {
},
},
methods
:
{
addComment
(
comment
)
{
this
.
notes
.
push
(
co
mment
);
addComment
(
{
response
}
)
{
this
.
notes
.
push
(
co
nvertObjectPropsToCamelCase
(
response
)
);
},
updateComment
({
response
,
comment
})
{
const
index
=
this
.
notes
.
indexOf
(
comment
);
if
(
index
>
-
1
)
{
this
.
notes
.
splice
(
index
,
1
,
{
...
comment
,
...
response
});
this
.
notes
.
splice
(
index
,
1
,
{
...
comment
,
...
convertObjectPropsToCamelCase
(
response
)
});
}
},
removeComment
(
comment
)
{
...
...
ee/spec/frontend/vulnerabilities/history_entry_spec.js
View file @
e0919ad3
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
;
...
...
@@ -81,23 +82,27 @@ describe('History Entry', () => {
expect
(
commentAt
(
1
).
props
(
'
comment
'
)).
toEqual
(
commentNoteClone
);
});
it
(
'
adds a new comment correctly
'
,
()
=>
{
it
(
'
adds a new comment correctly
'
,
async
()
=>
{
createWrapper
(
systemNote
);
newComment
().
vm
.
$emit
(
'
onCommentAdded
'
,
commentNote
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
newComment
().
exists
()).
toBe
(
false
);
expect
(
existingComments
()).
toHaveLength
(
1
);
expect
(
commentAt
(
0
).
props
(
'
comment
'
)).
toEqual
(
commentNote
);
newComment
().
vm
.
$emit
(
'
onCommentAdded
'
,
{
response
:
convertObjectPropsToSnakeCase
(
commentNote
),
});
await
wrapper
.
vm
.
$nextTick
();
expect
(
newComment
().
exists
()).
toBe
(
false
);
expect
(
existingComments
()).
toHaveLength
(
1
);
expect
(
commentAt
(
0
).
props
(
'
comment
'
)).
toEqual
(
commentNote
);
});
it
(
'
updates an existing comment correctly
'
,
async
()
=>
{
const
response
=
{
note
:
'
new note
'
};
createWrapper
(
systemNote
,
commentNote
);
await
commentAt
(
0
).
vm
.
$emit
(
'
onCommentUpdated
'
,
{
response
,
comment
:
commentNote
});
commentAt
(
0
).
vm
.
$emit
(
'
onCommentUpdated
'
,
{
response
,
comment
:
commentNote
});
await
wrapper
.
vm
.
$nextTick
();
expect
(
commentAt
(
0
).
props
(
'
comment
'
)
.
note
).
toBe
(
response
.
note
);
expect
(
commentAt
(
0
).
props
(
'
comment
'
)
).
toEqual
({
...
commentNote
,
note
:
response
.
note
}
);
});
it
(
'
deletes an existing comment correctly
'
,
async
()
=>
{
...
...
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