jenkins-bot has submitted this change and it was merged.

Change subject: Check for "albums" keyword when matching Flickr URL
......................................................................


Check for "albums" keyword when matching Flickr URL

Flickr treats albums as an alias to sets and redirects any requests from:
/photos/.../albums/... to /photos/.../sets/...
Updating Regex matching pattern to account for this will allow to use
both URL formats instead of ignoring "albums" and falling back to the
default behaviour pulling all user's public pictures (instead of using
the provided set).

Bug: T126119
Bug: T128767
Change-Id: I588eea01c5334fa4554cb7a8b173a89f0e792d8a
---
M resources/mw.FlickrChecker.js
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index 851381b..ce5c5fb 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -77,7 +77,7 @@
                        var photoIdMatches, albumIdMatches, 
userCollectionMatches, userPhotostreamMatches, groupPoolMatches, 
userGalleryMatches, userFavoritesMatches;
 
                        photoIdMatches = flickrInputUrl.match( 
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/([0-9]+)/ );
-                       albumIdMatches = flickrInputUrl.match( 
/flickr\.com\/photos\/[^\/]+\/sets\/([0-9]+)/ );
+                       albumIdMatches = flickrInputUrl.match( 
/flickr\.com\/photos\/[^\/]+\/(sets|albums)\/([0-9]+)/ );
                        userCollectionMatches = flickrInputUrl.match( 
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/collections\/?([0-9]+)?/ );
                        userPhotostreamMatches = flickrInputUrl.match( 
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/([^\/]+)/ );
                        groupPoolMatches = flickrInputUrl.match( 
/flickr\.com\/groups\/[^\/]+(?:\/pool\/([^\/]+))?/ );
@@ -92,7 +92,7 @@
                                groupPoolMatches || userGalleryMatches || 
userFavoritesMatches ) {
                                $( '#mwe-upwiz-upload-add-flickr-container' 
).hide();
                                this.imageUploads = [];
-                               if ( albumIdMatches && albumIdMatches[ 1 ] > 0 
) {
+                               if ( albumIdMatches && albumIdMatches[ 2 ] > 0 
) {
                                        this.getPhotoset( albumIdMatches, 
flickrInputUrl );
                                } else if ( photoIdMatches && photoIdMatches[ 1 
] > 0 ) {
                                        this.getPhoto( photoIdMatches, 
flickrInputUrl );
@@ -329,7 +329,7 @@
                getPhotoset: function ( albumIdMatches ) {
                        return this.getPhotos( 'photoset', {
                                method: 'flickr.photosets.getPhotos',
-                               photoset_id: albumIdMatches[ 1 ]
+                               photoset_id: albumIdMatches[ 2 ]
                        } );
                },
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I588eea01c5334fa4554cb7a8b173a89f0e792d8a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Ferveo <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to