Mholloway has uploaded a new change for review.

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

Change subject: WIP: Flatten media structure
......................................................................

WIP: Flatten media structure

Eliminate the image/video distinction for greater flexibility in ordering.

This currently breaks one test; needs further investigation.

Bug: T109105
Change-Id: Ib26cb183f322ed7f7413c64f0e748162d8dbc890
---
M lib/gallery.js
M test/features/mobile-html-sections-remaining/pagecontent.js
M test/features/mobile-html-sections/pagecontent.js
M test/features/mobile-html/pagecontent.js
4 files changed, 11 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps 
refs/changes/20/232320/1

diff --git a/lib/gallery.js b/lib/gallery.js
index d0b4c45..4f635bc 100644
--- a/lib/gallery.js
+++ b/lib/gallery.js
@@ -187,8 +187,7 @@
     }).then(function (response) {
         var detailsPromises = onGalleryCollectionsResponse(logger, response, 
domain);
         return BBPromise.props({
-            videos: detailsPromises.videos,
-            images: detailsPromises.images
+            items: detailsPromises.images + detailsPromises.videos
         });
     });
 }
diff --git a/test/features/mobile-html-sections-remaining/pagecontent.js 
b/test/features/mobile-html-sections-remaining/pagecontent.js
index dfa23a9..4557676 100644
--- a/test/features/mobile-html-sections-remaining/pagecontent.js
+++ b/test/features/mobile-html-sections-remaining/pagecontent.js
@@ -17,11 +17,11 @@
         return headers.checkHeaders(server.config.uri + 
'test.wikipedia.org/v1/page/mobile-html-sections-remaining/Test',
             'application/json');
     });
-    it('en Main page should have at least on image', function() {
+    it('en Main page should have at least one image', function() {
         return preq.get({ uri: server.config.uri + 
'en.wikipedia.org/v1/page/mobile-html-sections-remaining/Main_Page' })
             .then(function(res) {
                 var remaining = res.body;
-                assert.ok(remaining.media.images.length > 0, 'Expected at 
least one image');
+                assert.ok(remaining.media.items.length > 0, 'Expected at least 
one media item');
             });
     });
     it('Obama (redirect) should have at least one video, and many images', 
function() {
@@ -35,8 +35,7 @@
                 assert.ok(remaining.sections[0].text.length > 3);
                 assert.ok(remaining.sections[0].line.length > 3);
                 assert.ok(remaining.sections[0].anchor.length > 3);
-                assert.ok(remaining.media.videos.length > 0, 'Expected at 
least one video');
-                assert.ok(remaining.media.images.length > 3, 'Expected many 
images');
+                assert.ok(remaining.media.items.length > 3, 'Expected many 
media items');
             });
     });
-});
\ No newline at end of file
+});
diff --git a/test/features/mobile-html-sections/pagecontent.js 
b/test/features/mobile-html-sections/pagecontent.js
index c2661ce..a905fdd 100644
--- a/test/features/mobile-html-sections/pagecontent.js
+++ b/test/features/mobile-html-sections/pagecontent.js
@@ -55,10 +55,10 @@
                 assert.ok(lead.sections[0].text.length > 0, 'Expected text to 
be non-empty');
 
                 var remaining = res.body.remaining;
-                assert.ok(remaining.media.images.length > 0, 'Expected at 
least one image');
+                assert.ok(remaining.media.items.length > 0, 'Expected at least 
one media item');
             });
     });
-    it('Obama (redirect) should have a lead image, at least one video, and 
many images', function() {
+    it('Obama (redirect) should have a lead image and many media items', 
function() {
         return preq.get({ uri: server.config.uri + 
'en.wikipedia.org/v1/page/mobile-html-sections/Obama' })
             .then(function(res) {
                 var lead = res.body.lead;
@@ -79,8 +79,8 @@
                 assert.ok(remaining.sections[0].text.length > 3);
                 assert.ok(remaining.sections[0].line.length > 3);
                 assert.ok(remaining.sections[0].anchor.length > 3);
-                assert.ok(remaining.media.videos.length > 0, 'Expected at 
least one video');
-                assert.ok(remaining.media.images.length > 3, 'Expected many 
images');
+                assert.ok(remaining.media.items.length > 0, 'Expected at least 
one video');
+                assert.ok(remaining.media.items.length > 3, 'Expected many 
images');
             });
     });
-});
\ No newline at end of file
+});
diff --git a/test/features/mobile-html/pagecontent.js 
b/test/features/mobile-html/pagecontent.js
index d29b748..d8205d4 100644
--- a/test/features/mobile-html/pagecontent.js
+++ b/test/features/mobile-html/pagecontent.js
@@ -72,4 +72,4 @@
                 assert.deepEqual(res.status, 200);
             });
     });
-});
\ No newline at end of file
+});

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib26cb183f322ed7f7413c64f0e748162d8dbc890
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>

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

Reply via email to