Nischayn22 has uploaded a new change for review. https://gerrit.wikimedia.org/r/56371
Change subject: Check protection status of titles in details step. ...................................................................... Check protection status of titles in details step. Improved version of https://gerrit.wikimedia.org/r/23007 Thanks to DJ for that patch. Note: This is still not verified, I have to find a way to protect certain titles to test this yet. Bug 37107 Change-Id: Ic951851ddb46b5a80af0ef4ce248a3fdb46ea1b4 --- M resources/mw.DestinationChecker.js M resources/mw.UploadWizardDetails.js 2 files changed, 20 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard refs/changes/71/56371/1 diff --git a/resources/mw.DestinationChecker.js b/resources/mw.DestinationChecker.js index 38a43ba..5880cdf 100644 --- a/resources/mw.DestinationChecker.js +++ b/resources/mw.DestinationChecker.js @@ -208,7 +208,8 @@ // XXX do not use iiurlwidth as it will create a thumbnail var params = { 'titles': title, - 'prop': 'imageinfo', + 'prop': 'info|imageinfo', + 'inprop': 'protection', 'iiprop': 'url|mime|size', 'iiurlwidth': 150 }; @@ -236,9 +237,20 @@ // If file found on another repository, such as when the wiki is using InstantCommons: page with a key of -1, plus imageinfo // If file found on this repository: page with some positive numeric key if ( data.query.pages[-1] && !data.query.pages[-1].imageinfo ) { - // No conflict found on any repository this wiki uses - result = { isUnique: true }; - + if ( data.query.pages[-1].protection ) { + var protection = data.query.pages[-1].protection; + $.each( protection, function( i, val ) { + if ( !$.inArray( val.level, mw.config.get( 'wgUserGroups' ) ) ) { + result = { + isUnique: true, + isProtected: true + }; + } + } ); + } else { + // No conflict found on any repository this wiki uses + result = { isUnique: true }; + } } else { for ( var page_id in data.query.pages ) { diff --git a/resources/mw.UploadWizardDetails.js b/resources/mw.UploadWizardDetails.js index 65956f4..d7771fd 100644 --- a/resources/mw.UploadWizardDetails.js +++ b/resources/mw.UploadWizardDetails.js @@ -733,7 +733,7 @@ var _this = this; var $errorEl = _this.$form.find( 'label[for=' + _this.titleId + '].errorTitleUnique' ); - if ( result.unique.isUnique && result.blacklist.notBlacklisted ) { + if ( result.unique.isUnique && result.blacklist.notBlacklisted && !result.unique.isProtected ) { $j( _this.titleInput ).data( 'valid', true ); $errorEl.hide().empty(); _this.ignoreWarningsInput = undefined; @@ -762,6 +762,9 @@ } $errorEl.html( errHtml ).show(); + } else if ( result.unique.isProtected ) { + errHtml = mw.msg( 'mwe-upwiz-error-title-protected' ); + $errorEl.html( errHtml ); } else { errHtml = gM( 'mwe-upwiz-blacklisted', titleString ); -- To view, visit https://gerrit.wikimedia.org/r/56371 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic951851ddb46b5a80af0ef4ce248a3fdb46ea1b4 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
