Commit 7a77698f authored by Michał Zając's avatar Michał Zając

Use {issue,merge_request}_feedback in footer

parent 71ec3c49
...@@ -43,7 +43,8 @@ function createFooterApp() { ...@@ -43,7 +43,8 @@ function createFooterApp() {
hasMr, hasMr,
discussionsUrl, discussionsUrl,
state, state,
issueFeedback: feedback, issueFeedback,
mergeRequestFeedback,
notesUrl, notesUrl,
project, project,
remediations, remediations,
...@@ -68,7 +69,8 @@ function createFooterApp() { ...@@ -68,7 +69,8 @@ function createFooterApp() {
vulnerabilityFeedbackHelpPath, vulnerabilityFeedbackHelpPath,
isStandaloneVulnerability: true, isStandaloneVulnerability: true,
}, },
feedback, issueFeedback,
mergeRequestFeedback,
project: { project: {
url: project.full_path, url: project.full_path,
value: project.full_name, value: project.full_name,
......
...@@ -30,6 +30,16 @@ export default { ...@@ -30,6 +30,16 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
issueFeedback: {
type: Object,
required: false,
default: () => null,
},
mergeRequestFeedback: {
type: Object,
required: false,
default: () => null,
},
}, },
data: () => ({ data: () => ({
...@@ -150,16 +160,16 @@ export default { ...@@ -150,16 +160,16 @@ export default {
<div data-qa-selector="vulnerability_footer"> <div data-qa-selector="vulnerability_footer">
<solution-card v-if="hasSolution" v-bind="solutionInfo" /> <solution-card v-if="hasSolution" v-bind="solutionInfo" />
<div v-if="project.issue_feedback || project.merge_request_feedback" class="card"> <div v-if="issueFeedback || mergeRequestFeedback" class="card">
<issue-note <issue-note
v-if="project.issue_feedback" v-if="issueFeedback"
:feedback="project.issue_feedback" :feedback="issueFeedback"
:project="project" :project="project"
class="card-body" class="card-body"
/> />
<merge-request-note <merge-request-note
v-if="project.merge_request_feedback" v-if="mergeRequestFeedback"
:feedback="project.merge_request_feedback" :feedback="mergeRequestFeedback"
:project="project" :project="project"
class="card-body" class="card-body"
/> />
......
...@@ -29,11 +29,10 @@ describe('Vulnerability Footer', () => { ...@@ -29,11 +29,10 @@ describe('Vulnerability Footer', () => {
}, },
finding: {}, finding: {},
notesUrl: '/notes', notesUrl: '/notes',
}; project: {
full_path: '/root/security-reports',
const project = { full_name: 'Administrator / Security Reports',
full_path: '/root/security-reports', },
full_name: 'Administrator / Security Reports',
}; };
const solutionInfoProp = { const solutionInfoProp = {
...@@ -81,22 +80,18 @@ describe('Vulnerability Footer', () => { ...@@ -81,22 +80,18 @@ describe('Vulnerability Footer', () => {
}); });
describe.each` describe.each`
type | prop | component type | prop | component
${'issue'} | ${'issue_feedback'} | ${IssueNote} ${'issue'} | ${'issueFeedback'} | ${IssueNote}
${'merge request'} | ${'merge_request_feedback'} | ${MergeRequestNote} ${'merge request'} | ${'mergeRequestFeedback'} | ${MergeRequestNote}
`('$type note', ({ prop, component }) => { `('$type note', ({ prop, component }) => {
// The object itself does not matter, we just want to make sure it's passed to the issue note. // The object itself does not matter, we just want to make sure it's passed to the issue note.
const feedback = {}; const feedback = {};
it('shows issue note when an issue exists for the vulnerability', () => { it('shows issue note when an issue exists for the vulnerability', () => {
createWrapper({ ...minimumProps, finding: { project, [prop]: feedback } }); createWrapper({ ...minimumProps, [prop]: feedback });
expect(wrapper.contains(component)).toBe(true); expect(wrapper.contains(component)).toBe(true);
expect(wrapper.find(component).props()).toMatchObject({ expect(wrapper.find(component).props()).toMatchObject({
feedback, feedback,
project: {
url: project.full_path,
value: project.full_name,
},
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment