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() {
hasMr,
discussionsUrl,
state,
issueFeedback: feedback,
issueFeedback,
mergeRequestFeedback,
notesUrl,
project,
remediations,
......@@ -68,7 +69,8 @@ function createFooterApp() {
vulnerabilityFeedbackHelpPath,
isStandaloneVulnerability: true,
},
feedback,
issueFeedback,
mergeRequestFeedback,
project: {
url: project.full_path,
value: project.full_name,
......
......@@ -30,6 +30,16 @@ export default {
type: Object,
required: true,
},
issueFeedback: {
type: Object,
required: false,
default: () => null,
},
mergeRequestFeedback: {
type: Object,
required: false,
default: () => null,
},
},
data: () => ({
......@@ -150,16 +160,16 @@ export default {
<div data-qa-selector="vulnerability_footer">
<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
v-if="project.issue_feedback"
:feedback="project.issue_feedback"
v-if="issueFeedback"
:feedback="issueFeedback"
:project="project"
class="card-body"
/>
<merge-request-note
v-if="project.merge_request_feedback"
:feedback="project.merge_request_feedback"
v-if="mergeRequestFeedback"
:feedback="mergeRequestFeedback"
:project="project"
class="card-body"
/>
......
......@@ -29,11 +29,10 @@ describe('Vulnerability Footer', () => {
},
finding: {},
notesUrl: '/notes',
};
const project = {
full_path: '/root/security-reports',
full_name: 'Administrator / Security Reports',
project: {
full_path: '/root/security-reports',
full_name: 'Administrator / Security Reports',
},
};
const solutionInfoProp = {
......@@ -81,22 +80,18 @@ describe('Vulnerability Footer', () => {
});
describe.each`
type | prop | component
${'issue'} | ${'issue_feedback'} | ${IssueNote}
${'merge request'} | ${'merge_request_feedback'} | ${MergeRequestNote}
type | prop | component
${'issue'} | ${'issueFeedback'} | ${IssueNote}
${'merge request'} | ${'mergeRequestFeedback'} | ${MergeRequestNote}
`('$type note', ({ prop, component }) => {
// The object itself does not matter, we just want to make sure it's passed to the issue note.
const feedback = {};
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.find(component).props()).toMatchObject({
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