Skip to content

Commit 35f3878

Browse files
authored
feat(corpus): [MC-1446] Add new 'Publisher Request' rejection reason (#1216)
1 parent 437c01f commit 35f3878

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

src/api/generatedTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,7 @@ export enum RejectionReason {
18461846
Paywall = 'PAYWALL',
18471847
PoliticalOpinion = 'POLITICAL_OPINION',
18481848
PublisherQuality = 'PUBLISHER_QUALITY',
1849+
PublisherRequest = 'PUBLISHER_REQUEST',
18491850
TimeSensitive = 'TIME_SENSITIVE',
18501851
}
18511852

src/curated-corpus/components/RejectItemForm/RejectItemForm.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ describe('The RejectItemForm component', () => {
1818
render(<RejectItemForm onSubmit={handleSubmit} />);
1919

2020
const checkboxes = screen.getAllByRole('checkbox');
21-
// We have six rejection reasons. They come from an enum in the Curated Corpus
21+
// We have seven rejection reasons. They come from an enum in the Curated Corpus
2222
// API schema - RejectionReason and are available through the codegen types.
23-
expect(checkboxes).toHaveLength(6);
23+
expect(checkboxes).toHaveLength(7);
2424

2525
const buttons = screen.getAllByRole('button');
2626
// "Save" and "Cancel" buttons are expected here.

src/curated-corpus/components/RejectItemForm/RejectItemForm.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const RejectItemForm: React.FC<
3838
[RejectionReason.OffensiveMaterial]: false,
3939
[RejectionReason.TimeSensitive]: false,
4040
[RejectionReason.Misinformation]: false,
41+
[RejectionReason.PublisherRequest]: false,
4142
[RejectionReason.Other]: false,
4243
reason: '',
4344
},
@@ -97,10 +98,6 @@ export const RejectItemForm: React.FC<
9798
}
9899
label="Offensive material"
99100
/>
100-
</FormGroup>
101-
</Grid>
102-
<Grid item xs={12} sm={6}>
103-
<FormGroup>
104101
<FormControlLabel
105102
control={
106103
<Checkbox
@@ -112,6 +109,10 @@ export const RejectItemForm: React.FC<
112109
}
113110
label="Time sensitive"
114111
/>
112+
</FormGroup>
113+
</Grid>
114+
<Grid item xs={12} sm={6}>
115+
<FormGroup>
115116
<FormControlLabel
116117
control={
117118
<Checkbox
@@ -123,6 +124,17 @@ export const RejectItemForm: React.FC<
123124
}
124125
label="Misinformation"
125126
/>
127+
<FormControlLabel
128+
control={
129+
<Checkbox
130+
color="primary"
131+
{...formik.getFieldProps({
132+
name: RejectionReason.PublisherRequest,
133+
})}
134+
/>
135+
}
136+
label="Publisher Request"
137+
/>
126138
<FormControlLabel
127139
control={
128140
<Checkbox

src/curated-corpus/components/RejectItemForm/RejectItemForm.validation.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const validationSchema = yup
88
[RejectionReason.OffensiveMaterial]: yup.boolean(),
99
[RejectionReason.TimeSensitive]: yup.boolean(),
1010
[RejectionReason.Misinformation]: yup.boolean(),
11+
[RejectionReason.PublisherRequest]: yup.boolean(),
1112
[RejectionReason.Other]: yup.boolean(),
1213
})
1314
.test('reason', '', (obj) => {
@@ -18,6 +19,7 @@ export const validationSchema = yup
1819
obj[RejectionReason.OffensiveMaterial] ||
1920
obj[RejectionReason.TimeSensitive] ||
2021
obj[RejectionReason.Misinformation] ||
22+
obj[RejectionReason.PublisherRequest] ||
2123
obj[RejectionReason.Other]
2224
) {
2325
return true;

0 commit comments

Comments
 (0)