Nischayn22 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/50953
Change subject: (bug 42554)[Untested] test titles in Details step.
......................................................................
(bug 42554)[Untested] test titles in Details step.
I still have to test this after installing Title Blacklist so please don't
merge.
Change-Id: I3cc0f0dd9c6930a98ddfb2657c891150688b05f5
---
M resources/jquery/jquery.validate.wmCommonsBlacklist.js
M resources/mw.DestinationChecker.js
M resources/mw.UploadWizardDetails.js
3 files changed, 17 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/53/50953/1
diff --git a/resources/jquery/jquery.validate.wmCommonsBlacklist.js
b/resources/jquery/jquery.validate.wmCommonsBlacklist.js
index e0a3fb0..bf84765 100644
--- a/resources/jquery/jquery.validate.wmCommonsBlacklist.js
+++ b/resources/jquery/jquery.validate.wmCommonsBlacklist.js
@@ -76,5 +76,18 @@
$.validator.addMethod( name, tester, "This title is not
allowed" );
} );
+ var tester = function ( value, element, params ) {
+ var ok = true;
+ var processBlacklistResult = function( result ) {
+ if ( result.blacklist.notBlacklisted !== true ) {
+ ok = false;
+ // TODO use the reason for blacklisting here
+ }
+ }
+ var checker = new mw.DestinationChecker( { 'selector': element
} );
+ checker.checkBlacklisted( processBlacklistResult );
+ return ok;
+ }
+ $.validator.addMethod( 'titleBlacklistCheck', tester, "This title is
blacklisted" );
} )( jQuery );
diff --git a/resources/mw.DestinationChecker.js
b/resources/mw.DestinationChecker.js
index 38a43ba..f453b93 100644
--- a/resources/mw.DestinationChecker.js
+++ b/resources/mw.DestinationChecker.js
@@ -124,6 +124,7 @@
_this.checkUnique( checkerStatus );
_this.checkBlacklist( checkerStatus );
+ return status;
},
/**
diff --git a/resources/mw.UploadWizardDetails.js
b/resources/mw.UploadWizardDetails.js
index 65956f4..960a72b 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -354,8 +354,10 @@
_this.$form.find( '.mwe-title' )
.rules( "add", {
required: true,
+ titleBlacklistCheck: true,
messages: {
- required: gM( 'mwe-upwiz-error-blank' )
+ required: gM( 'mwe-upwiz-error-blank' ),
+ titleBlacklistCheck: mw.msg(
'mwe-upwiz-error-title-badchars' )
}
} );
} else {
--
To view, visit https://gerrit.wikimedia.org/r/50953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3cc0f0dd9c6930a98ddfb2657c891150688b05f5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Nischayn22 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits