ItSpiderman has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361631 )

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.

Change-Id: I97bd61b498b998d7c9e4f477a2b4a0dfd8846b18
ERM: #6495
---
M InsertFile/resources/BS.InsertFile/UploadPanel.js
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/31/361631/1

diff --git a/InsertFile/resources/BS.InsertFile/UploadPanel.js 
b/InsertFile/resources/BS.InsertFile/UploadPanel.js
index 867915a..5e98087 100644
--- a/InsertFile/resources/BS.InsertFile/UploadPanel.js
+++ b/InsertFile/resources/BS.InsertFile/UploadPanel.js
@@ -328,11 +328,27 @@
                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
                                });

-- 
To view, visit https://gerrit.wikimedia.org/r/361631
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97bd61b498b998d7c9e4f477a2b4a0dfd8846b18
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: ItSpiderman <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to