Skip to content

Commit

Permalink
capitalize article assessments such as Start, Stub, etc.
Browse files Browse the repository at this point in the history
Evad37/rater.js does this. Let's copy this practice, so that rater diffs are smaller.

For example, the conversion of |class=start to |class=Start in this diff could have been avoided if AFCH had just written |class=Start in the first place:

https://en.wikipedia.org/w/index.php?title=Talk:Phare_Circus&diff=next&oldid=1242207529
  • Loading branch information
NovemLinguae committed Aug 26, 2024
1 parent 2523eb9 commit b98e4e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/modules/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@
}

// add disambiguation banner to array
if ( newAssessment === 'disambig' ) {
if ( newAssessment === 'Disambig' ) {
banners.push( '{{WikiProject Disambiguation}}' );
}

Expand Down
4 changes: 2 additions & 2 deletions src/modules/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@
// If draft is assessed as stub, show stub sorting
// interface using User:SD0001/StubSorter.js
$afch.find( '#newAssessment' ).on( 'change', function () {
const isClassStub = $( this ).val() === 'stub';
const isClassStub = $( this ).val() === 'Stub';
$afch.find( '#stubSorterWrapper' ).toggleClass( 'hidden', !isClassStub );
if ( isClassStub ) {
if ( mw.config.get( 'wgDBname' ) !== 'enwiki' ) {
Expand All @@ -1622,7 +1622,7 @@
$( '#stub-sorter-select' ).addClass( 'afch-input' );

if ( /\{\{[^{ ]*[sS]tub(\|.*?)?\}\}\s*/.test( pageText ) ) {
$afch.find( '#newAssessment' ).val( 'stub' ).trigger( 'chosen:updated' ).trigger( 'change' );
$afch.find( '#newAssessment' ).val( 'Stub' ).trigger( 'chosen:updated' ).trigger( 'change' );
}
} );
}
Expand Down
18 changes: 9 additions & 9 deletions src/templates/tpl-submissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
<option value="" selected></option>
<option value="B">B-class</option>
<option value="C">C-class</option>
<option value="start">Start-class</option>
<option value="stub">Stub-class</option>
<option value="list">List-class</option>
<option value="disambig">Disambig-class</option>
<option value="template">Template-class</option>
<option value="redirect">Redirect-class</option>
<option value="portal">Portal-class</option>
<option value="project">Project-class</option>
<option value="na">NA-class</option>
<option value="Start">Start-class</option>
<option value="Stub">Stub-class</option>
<option value="List">List-class</option>
<option value="Disambig">Disambig-class</option>
<option value="Template">Template-class</option>
<option value="Redirect">Redirect-class</option>
<option value="Portal">Portal-class</option>
<option value="Project">Project-class</option>
<option value="NA">NA-class</option>
</select>
</div>

Expand Down
4 changes: 2 additions & 2 deletions tests/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,15 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="

it( 'user selects class = disambiguation', () => {
const wikicode = '';
const newAssessment = 'disambig';
const newAssessment = 'Disambig';
const revId = 592681;
const isBiography = false;
const newWikiProjects = [];
const lifeStatus = 'unknown';
const subjectName = '';
const output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|class=disambig|1=
`{{WikiProject banner shell|class=Disambig|1=
{{subst:WPAFC/article|oldid=592681}}
{{WikiProject Disambiguation}}
}}`
Expand Down

0 comments on commit b98e4e0

Please sign in to comment.