ItSpiderman has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/361634 )
Change subject: InsertFile: Fix for missing duplicate warnings
......................................................................
InsertFile: Fix for missing duplicate warnings
If you try to upload Test.pdf while already having Test.png on the wiki
there will be a warning, and this warning appears on Special:Upload, but
not on InsertFile upload dialog. There is only shows empty alert dialog.
In the case like normal check for duplicates does not retrieve anything
but the warning appears on upload action. But it does not appear in normal
"duplicates" node of response, but as "exists-normalized" and "exists"
attributes.
This kind of warnings also occures when getting normal duplicate warnings
but choosing not to ignore warnings.
Needs cherry-picking to REL1_27
Change-Id: I01175f1b926d82e9be6bcf0d3c5d6b744df036ca
ERM: #6495
---
M resources/bluespice.extjs/BS/panel/Upload.js
1 file changed, 18 insertions(+), 3 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation
refs/changes/34/361634/1
diff --git a/resources/bluespice.extjs/BS/panel/Upload.js
b/resources/bluespice.extjs/BS/panel/Upload.js
index ebd6ca5..557e1ff 100755
--- a/resources/bluespice.extjs/BS/panel/Upload.js
+++ b/resources/bluespice.extjs/BS/panel/Upload.js
@@ -332,10 +332,26 @@
var warningsTag =
uploadTag.getElementsByTagName('warnings').item(0);
if( warningsTag !== null && imageinfoTag === null ) {
var duplicate =
warningsTag.getElementsByTagName('duplicate');
- if( duplicate !== null && duplicate.length > 0 ) {
+ if( duplicate === null ) {
+ duplicate = [];
+ }
+
+ var secondaryWarnings = [];
+ if( warningsTag.getAttribute('exists-normalized') ) {
+ secondaryWarnings.push(
warningsTag.getAttribute('exists-normalized') );
+ }
+ if( warningsTag.getAttribute('exists') ) {
+ secondaryWarnings.push(
warningsTag.getAttribute('exists') );
+ }
+
+ if( duplicate.length > 0 || secondaryWarnings.length >
0 ) {
var dupUrls = [];
$.each(duplicate, function() {
dupUrls.push( "File:"+this.textContent
);
+ });
+
+ $.each(secondaryWarnings, function( idx,
filename ) {
+ dupUrls.push( "File:"+filename );
});
this.duplicateWarning({
titles: dupUrls
@@ -346,11 +362,10 @@
bs.util.alert(
this.getId()+'-warning',
{
- title:
mw.message('bs-upload-error').plain(),
+ title:
mw.message('bs-insertfile-error').plain(),
text: $(warningsTag).html()
}
);
-
return;
}
--
To view, visit https://gerrit.wikimedia.org/r/361634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01175f1b926d82e9be6bcf0d3c5d6b744df036ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits