Skip to content

Commit

Permalink
detect submitted drafts in userspace
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Mar 26, 2024
1 parent aabf388 commit 584a766
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions DontForgetG12.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class DontForgetG12 {
}

// Only run if 1) draft is submitted
const draftIsSubmitted = this.wikicode.match( /(?:{{AfC submission}}|{{AfC submission\|}}|{{AfC submission\|\|)/i ) && this.namespace === 118;
const isDraftspaceOrUserspace = [ 118, 2 ].includes( this.namespace );
const draftIsSubmitted = this.wikicode.match( /(?:{{AfC submission}}|{{AfC submission\|}}|{{AfC submission\|\|)/i ) && isDraftspaceOrUserspace;
if ( draftIsSubmitted ) {
this.insertButton( this.title );
}
Expand Down Expand Up @@ -60,9 +61,9 @@ class DontForgetG12 {
return false;
}

// Only run in mainspace and draftspace
this.namespace = this.mw.config.get( 'wgNamespaceNumber' );
if ( ![ 0, 118 ].includes( this.namespace ) ) {
const isMainspaceDraftspaceOrUserspace = [ 0, 118, 2 ].includes( this.namespace );
if ( !isMainspaceDraftspaceOrUserspace ) {
return false;
}

Expand Down

0 comments on commit 584a766

Please sign in to comment.