Kaldari has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59000
Change subject: Making sure unique titles are generated from Flickr images
......................................................................
Making sure unique titles are generated from Flickr images
Bug: 43320
Change-Id: Icae2e54866aa63531b4eef1262a0798bcc51cf8f
---
M resources/mw.FlickrChecker.js
1 file changed, 15 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/00/59000/1
diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index 68cbef8..a7ca62a 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -87,15 +87,16 @@
var licenseValue =
license.licenseValue;
var sameTitleExists =
false;
if ( licenseValue !==
'invalid' ) {
-
$.each(
_this.imageUploads, function ( index, image ) {
if (
image.name === item.title + '.jpg' ) {
sameTitleExists = true;
return false; // Break out of the loop
}
} );
- // if the photo
is untitled or a same title exists, generate a title
- if ( item.title
=== '' || sameTitleExists ) {
+ // if the photo
is untitled or the same title exists, generate a title
+ if ( item.title
=== '' ) {
+
fileName = item.ownername + '-' + item.id + '.jpg';
+ } else if (
sameTitleExists ) {
fileName = item.title + ' - ' + item.id + '.jpg';
} else {
fileName = item.title + '.jpg';
@@ -183,10 +184,19 @@
function( data ) {
if ( typeof data.photo !== 'undefined' ) {
var license = _this.checkLicense(
data.photo.license );
- if ( license.licenseValue != 'invalid'
) {
- // if the photo is untitled,
generate a title
+ var sameTitleExists = false;
+ if ( license.licenseValue !== 'invalid'
) {
+ $.each( _this.imageUploads,
function ( index, image ) {
+ if ( image.name ===
data.photo.title._content + '.jpg' ) {
+ sameTitleExists
= true;
+ return false;
// Break out of the loop
+ }
+ } );
+ // if the photo is untitled or
the same title exists, generate a title
if ( data.photo.title._content
=== '' ) {
fileName =
data.photo.owner.username + '-' + data.photo.id + '.jpg';
+ } else if ( sameTitleExists ) {
+ fileName =
data.photo.title._content + ' - ' + data.photo.id + '.jpg';
} else {
fileName =
data.photo.title._content + '.jpg';
}
--
To view, visit https://gerrit.wikimedia.org/r/59000
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icae2e54866aa63531b4eef1262a0798bcc51cf8f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits