PortableInfoboxBuilder: Force "Template:" prefix on publishing (#53)

This commit is contained in:
Universal Omega 2021-12-27 13:14:28 -07:00 committed by GitHub
parent c934b05a49
commit 5ef16a60b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -245,13 +245,15 @@
required: true required: true
} }
} ).done( ( title ) => { } ).done( ( title ) => {
if ( title === null || title.trim() === "" ) { if ( title === null || title.trim() === '' ) {
return; return;
} }
let namespace = ( title.substring( 0, 9 ) !== 'Template:' ? 'Template:' : '' );
this.api.postWithToken( 'csrf', { this.api.postWithToken( 'csrf', {
action: 'edit', action: 'edit',
title: title, title: namespace + title,
text: this.getInfoboxMarkup(), text: this.getInfoboxMarkup(),
summary: this.msg( 'editsummary' ), summary: this.msg( 'editsummary' ),
notminor: true, notminor: true,