Skip to content

Commit 14c1b81

Browse files
cci: add option for presumptive removal
1 parent fbe5826 commit 14c1b81

File tree

6 files changed

+39
-5
lines changed

6 files changed

+39
-5
lines changed

i18n/core/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"deputy.session.row.status.withViolations": "Violations found",
3434
"deputy.session.row.status.withoutViolations": "No violations found",
3535
"deputy.session.row.status.missing": "Missing",
36+
"deputy.session.row.status.presumptiveRemoval": "Presumptively removed",
3637

3738
"deputy.session.row.details.new": "created",
3839
"deputy.session.row.details.edits": "{{PLURAL:$1|$1 edit|{{FORMATNUM:$1}} edits}}",

src/models/ContributionSurveyRow.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export enum ContributionSurveyRowStatus {
1313
// The row has been processed and violations were not found ({{n}})
1414
WithoutViolations = 3,
1515
// The row has been found but the added text is no longer in the existing revision
16-
Missing = 4
16+
Missing = 4,
17+
// The row has been processed and text was presumptively removed ({{x}}),
18+
PresumptiveRemoval = 5
1719
}
1820

1921
/**
@@ -45,7 +47,8 @@ export default class ContributionSurveyRow {
4547
// TODO: Wiki localization
4648
[ ContributionSurveyRowStatus.WithViolations ]: /\{\{(aye|y)}}/gi,
4749
[ ContributionSurveyRowStatus.WithoutViolations ]: /\{\{n(ay)?}}/gi,
48-
[ ContributionSurveyRowStatus.Missing ]: /\{\{\?}}/gi
50+
[ ContributionSurveyRowStatus.Missing ]: /\{\{\?}}/gi,
51+
[ ContributionSurveyRowStatus.PresumptiveRemoval ]: /\{\{x}}/gi
4952
};
5053

5154
/**

src/ui/root/DeputyContributionSurveyRow.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export default class DeputyContributionSurveyRow implements DeputyUIElement {
5353
[ ContributionSurveyRowStatus.Unknown ]: 'alert',
5454
[ ContributionSurveyRowStatus.WithViolations ]: 'check',
5555
[ ContributionSurveyRowStatus.WithoutViolations ]: 'close',
56-
[ ContributionSurveyRowStatus.Missing ]: 'help'
56+
[ ContributionSurveyRowStatus.Missing ]: 'help',
57+
[ ContributionSurveyRowStatus.PresumptiveRemoval ]: 'trash'
5758
};
5859

5960
disabled: boolean;
@@ -258,6 +259,7 @@ export default class DeputyContributionSurveyRow implements DeputyUIElement {
258259
const useUserData = () => {
259260
let addComments = false;
260261
switch ( this.status ) {
262+
// TODO: l10n
261263
case ContributionSurveyRowStatus.Unfinished:
262264
// This state should not exist. Just add signature (done outside of switch).
263265
break;
@@ -279,6 +281,10 @@ export default class DeputyContributionSurveyRow implements DeputyUIElement {
279281
result += '{{?}}';
280282
addComments = true;
281283
break;
284+
case ContributionSurveyRowStatus.PresumptiveRemoval:
285+
result += '{{x}}';
286+
addComments = true;
287+
break;
282288
}
283289

284290
const userComments = this.comments

src/ui/shared/DeputyCCIStatusDropdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export default class DeputyCCIStatusDropdown extends EventTarget {
3636
[ ContributionSurveyRowStatus.Unknown ]: 'alert',
3737
[ ContributionSurveyRowStatus.WithViolations ]: 'check',
3838
[ ContributionSurveyRowStatus.WithoutViolations ]: 'close',
39-
[ ContributionSurveyRowStatus.Missing ]: 'help'
39+
[ ContributionSurveyRowStatus.Missing ]: 'help',
40+
[ ContributionSurveyRowStatus.PresumptiveRemoval ]: 'trash'
4041
};
4142

4243
/**
@@ -377,6 +378,7 @@ export default class DeputyCCIStatusDropdown extends EventTarget {
377378
* - WithViolations: _usually not disabled, kept as is_
378379
* - WithoutViolations: _usually not disabled, kept as is_
379380
* - Missing: _usually not disabled, kept as is_
381+
* - PresumptiveRemoval: _usually not disabled, kept as is_
380382
*
381383
* @param status The status that was <b>changed into</b>
382384
*/

src/wiki/DeputyCasePage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export default class DeputyCasePage extends DeputyCase {
115115
*/
116116
isContributionSurveyHeading( el: HTMLElement ): el is ContributionSurveyHeading {
117117
// All headings (h1, h2, h3, h4, h5, h6)
118+
// TODO: l10n
118119
const headlineElement = this.parsoid ? el : el.querySelector<HTMLElement>( '.mw-headline' );
119120
return /^H\d$/.test( el.tagName ) &&
120121
headlineElement != null &&
@@ -157,7 +158,7 @@ export default class DeputyCasePage extends DeputyCase {
157158
throw new Error( 'Current page is not a case page.' );
158159
} else {
159160
return ( Array.from( this.document.querySelectorAll(
160-
// All headings (h1, h2, h3, h4, h5, h6)
161+
// All headings (`h1, h2, h3, h4, h5, h6`)
161162
[ 1, 2, 3, 4, 5, 6 ]
162163
.map( ( i ) => `.mw-parser-output h${i}` )
163164
.join( ',' )

tests/unit/ContributionSurveyRowUnitTests.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,27 @@ describe( 'ContributionSurveyRow static unit tests', () => {
138138
);
139139
} )
140140
).resolves.toBe( ContributionSurveyRowStatus.Missing ),
141+
expect(
142+
page.evaluate( () => {
143+
return window.deputy.models.ContributionSurveyRow.identifyCommentStatus(
144+
'{{x}}'
145+
);
146+
} )
147+
).resolves.toBe( ContributionSurveyRowStatus.PresumptiveRemoval ),
148+
expect(
149+
page.evaluate( () => {
150+
return window.deputy.models.ContributionSurveyRow.identifyCommentStatus(
151+
'BOOM {{x}}'
152+
);
153+
} )
154+
).resolves.toBe( ContributionSurveyRowStatus.PresumptiveRemoval ),
155+
expect(
156+
page.evaluate( () => {
157+
return window.deputy.models.ContributionSurveyRow.identifyCommentStatus(
158+
'{{x}} explosion!'
159+
);
160+
} )
161+
).resolves.toBe( ContributionSurveyRowStatus.PresumptiveRemoval ),
141162
expect(
142163
page.evaluate( () => {
143164
return window.deputy.models.ContributionSurveyRow.identifyCommentStatus(

0 commit comments

Comments
 (0)