Nischayn22 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/50760


Change subject: (bug 32606) Add a redlink to dead duplicate file links
......................................................................

(bug 32606) Add a redlink to dead duplicate file links

When a duplicate file is shown we should show a redlink=1 if the page
doesn't exist.

Note: This functionality only works if Title.exists() doesn't return a
null which it does most of the time :(

Change-Id: I09303ab4f2bafa558fec4f74866a0ab050ecc032
---
M resources/mw.UploadWizardUpload.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/60/50760/1

diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index dd6667e..db299fd 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -286,7 +286,12 @@
                $j.each( duplicates, function( i, filename ) {
                        var $a = $j( '<a/>' ).append( filename );
                        try {
-                               var href = new mw.Title( filename, fileNsId 
).getUrl();
+                               var title = new mw.Title( filename, fileNsId );
+                               href = title.getUrl();
+                               if ( title.exists() !== null && !title.exists() 
) {
+                                       href = href + '?&action=edit&redlink=1';
+                                       $a.addClass( "new" );
+                               }
                                $a.attr( { 'href': href, 'target': '_blank' } );
                        } catch ( e ) {
                                $a.click( function() { alert('could not parse 
filename=' + filename ); } );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09303ab4f2bafa558fec4f74866a0ab050ecc032
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

Reply via email to