[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Stop bundling ext.cite.style

2018-01-20 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405538 )

Change subject: Stop bundling ext.cite.style
..

Stop bundling ext.cite.style

Needed to restore the display of references in the app as a result of
a change in Parsoid.

Bug: T184476
Change-Id: I054ae7ab29bf982bac64644da6fb25a715406630
---
M app/src/main/assets/preview.css
M app/src/main/assets/styles.css
M scripts/make-css-assets.bash
3 files changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/38/405538/1

diff --git a/app/src/main/assets/preview.css b/app/src/main/assets/preview.css
index 3dbc608..b3e1dc5 100644
--- a/app/src/main/assets/preview.css
+++ b/app/src/main/assets/preview.css
@@ -1 +1 @@
-html,body,div,span,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,ins,em,img,small,strike,strong,sub,sup,tt,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,input,textarea,button,select,audio,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline;background:none}table,caption,tbody,tfoot,thead,tr,th,td{font-size:100%}caption{font-weight:bold}button{border:0;background-color:transparent}body{line-height:1;-webkit-tap-highlight-color:transparent}input{line-height:normal}ol,ul{list-style:none}table{border-collapse:collapse}html{-webkit-text-size-adjust:none;font-size:100%}body{font-family:'Helvetica
 Neue','Helvetica','Nimbus Sans L','Arial','Liberation 
Sans',sans-serif;line-height:1.4;color:#22;background:#fff}.content{line-height:1.65;word-wrap:break-word}@media
 all and (max-width:320px - 1){body{font-size:0.8em}.content{margin:0 
12px}}.client-js .collapsible-block{display:none}.client-js 
.collapsible-block.open-block{display:block}.nomobile{display:none 
!important}@media all and (min-width:720px){.client-js [onclick] + 
.collapsible-block{display:block}}.content figure,.content .thumb{margin:0.6em 
0}.content figure .thumbinner,.content .thumb .thumbinner{margin:0 
auto;max-width:100% !important}.content figcaption,.content 
.thumbcaption{margin:0.5em 0 0;font-size:0.8em;line-height:1.5;padding:0 
!important;color:#54595d}.content .thumbcaption{width:auto !important}.content 
.thumbborder{border:1px solid #c8ccd1}.content .magnify,.content 
figure[typeof*='mw:Image/Thumb'] > a:after,.content 
figure[typeof*='mw:Video/Thumb'] > a:after,.content 
figure[typeof*='mw:Audio/Thumb'] > a:after{display:none}.content 
img{vertical-align:middle}.content .floatright{clear:right;float:right;margin:0 
0 0.6em 0.6em}.content .floatleft{clear:left;float:left;margin:0 0.6em 0.6em 
0}.content a > img{max-width:100% !important;height:auto !important}.content 
.noresize{max-width:100%;overflow-x:auto}.content .noresize a > 
img{max-width:none 
!important}h1{font-size:1.7em}h2{font-size:1.5em}h3{font-size:1.2em;font-weight:bold}h4{font-weight:bold}.pre-content
 h1,.content h1,.content h2{font-family:'Linux 
Libertine','Georgia','Times',serif}h3,h4,h5,h6{font-family:'Helvetica 
Neue','Helvetica','Nimbus Sans L','Arial','Liberation 
Sans',sans-serif}.pre-content h1,.content h1,.content 
h2,h3,h4,h5,h6{line-height:1.3;word-wrap:break-word;word-break:break-word}.content
 h2,.content h3,.content h4,.content h5,.content h6{padding:0.5em 
0}blockquote{border-left:3px solid #c8ccd1;font-family:'Linux 
Libertine','Georgia','Times',serif;font-size:1.1em;padding:1em 25px 1em 
30px;position:relative;overflow:hidden}.content{}.content ul{list-style:square 
outside;padding-left:1em}.content ul > li > ul{list-style-type:disc}.content ul 
> li > ul > li > ul{list-style-type:circle}.content ol{list-style:decimal 
inside}.content ol ol,.content ul ol,.content ol ul,.content ul 
ul{margin-left:1em}.content ol li,.content ul li{margin-bottom:10px}.content ol 
li:last-child,.content ul 
li:last-child{margin-bottom:inherit}dl{margin-left:1em}dl 
dt{font-weight:bold}dl dd{display:block;overflow:auto}body.mw-hide-empty-elt 
.mw-empty-elt{display:none}a{text-decoration:none;color:#002bb8}a:visited{color:#5a3696}a:active{color:#faa700}a:hover{text-decoration:underline}a.new,a.new:visited,a.new:hover{color:#dd}a.new
 > *,a.new:visited > *,a.new:hover > 
*{color:#dd}a.external{background-image:url(data:image/png;base64,iVBORw0KGgoNSUhEUgoKCAYAAACNMs+9VElEQVR42n3PgQkAIAhEUXdqJ3dqJ3e6IoTPUSQcgj4EQ5IlUiLE0Jil3PECXhcHGBhZ8kg4hwxAu3MZeCGeyFnAXp4hqNQPnt7QL0nADpD6wHccLvnAKksq8iiaAElFTkSuQmCC);background-image:url(/w/skins/MinervaNeue/resources/skins.minerva.content.styles/images/external-link-ltr-icon.png?948bf)!ie;background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3C%3Fxml
 version=%221.0%22 encoding=%22UTF-8%22%3F%3E%3Csvg 
xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22%3E%3Cpath 
fill=%22%23fff%22 stroke=%22%2336c%22 d=%22M.5 
3.518h5.982V9.5H.5z%22/%3E%3Cpath 

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Fix: Update bundled CSS with Cite fix

2018-01-20 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405537 )

Change subject: Fix: Update bundled CSS with Cite fix
..

Fix: Update bundled CSS with Cite fix

Needed to restore reference display in the app.

Bug: T184476
Change-Id: I166b8a1356f91019012064b3eb4959dd3f31f6f0
---
M app/src/main/assets/preview.css
M app/src/main/assets/styles.css
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/37/405537/1

diff --git a/app/src/main/assets/preview.css b/app/src/main/assets/preview.css
index 3dbc608..fa48623 100644
--- a/app/src/main/assets/preview.css
+++ b/app/src/main/assets/preview.css
@@ -1 +1 @@
-html,body,div,span,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,ins,em,img,small,strike,strong,sub,sup,tt,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,input,textarea,button,select,audio,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline;background:none}table,caption,tbody,tfoot,thead,tr,th,td{font-size:100%}caption{font-weight:bold}button{border:0;background-color:transparent}body{line-height:1;-webkit-tap-highlight-color:transparent}input{line-height:normal}ol,ul{list-style:none}table{border-collapse:collapse}html{-webkit-text-size-adjust:none;font-size:100%}body{font-family:'Helvetica
 Neue','Helvetica','Nimbus Sans L','Arial','Liberation 
Sans',sans-serif;line-height:1.4;color:#22;background:#fff}.content{line-height:1.65;word-wrap:break-word}@media
 all and (max-width:320px - 1){body{font-size:0.8em}.content{margin:0 
12px}}.client-js .collapsible-block{display:none}.client-js 
.collapsible-block.open-block{display:block}.nomobile{display:none 
!important}@media all and (min-width:720px){.client-js [onclick] + 
.collapsible-block{display:block}}.content figure,.content .thumb{margin:0.6em 
0}.content figure .thumbinner,.content .thumb .thumbinner{margin:0 
auto;max-width:100% !important}.content figcaption,.content 
.thumbcaption{margin:0.5em 0 0;font-size:0.8em;line-height:1.5;padding:0 
!important;color:#54595d}.content .thumbcaption{width:auto !important}.content 
.thumbborder{border:1px solid #c8ccd1}.content .magnify,.content 
figure[typeof*='mw:Image/Thumb'] > a:after,.content 
figure[typeof*='mw:Video/Thumb'] > a:after,.content 
figure[typeof*='mw:Audio/Thumb'] > a:after{display:none}.content 
img{vertical-align:middle}.content .floatright{clear:right;float:right;margin:0 
0 0.6em 0.6em}.content .floatleft{clear:left;float:left;margin:0 0.6em 0.6em 
0}.content a > img{max-width:100% !important;height:auto !important}.content 
.noresize{max-width:100%;overflow-x:auto}.content .noresize a > 
img{max-width:none 
!important}h1{font-size:1.7em}h2{font-size:1.5em}h3{font-size:1.2em;font-weight:bold}h4{font-weight:bold}.pre-content
 h1,.content h1,.content h2{font-family:'Linux 
Libertine','Georgia','Times',serif}h3,h4,h5,h6{font-family:'Helvetica 
Neue','Helvetica','Nimbus Sans L','Arial','Liberation 
Sans',sans-serif}.pre-content h1,.content h1,.content 
h2,h3,h4,h5,h6{line-height:1.3;word-wrap:break-word;word-break:break-word}.content
 h2,.content h3,.content h4,.content h5,.content h6{padding:0.5em 
0}blockquote{border-left:3px solid #c8ccd1;font-family:'Linux 
Libertine','Georgia','Times',serif;font-size:1.1em;padding:1em 25px 1em 
30px;position:relative;overflow:hidden}.content{}.content ul{list-style:square 
outside;padding-left:1em}.content ul > li > ul{list-style-type:disc}.content ul 
> li > ul > li > ul{list-style-type:circle}.content ol{list-style:decimal 
inside}.content ol ol,.content ul ol,.content ol ul,.content ul 
ul{margin-left:1em}.content ol li,.content ul li{margin-bottom:10px}.content ol 
li:last-child,.content ul 
li:last-child{margin-bottom:inherit}dl{margin-left:1em}dl 
dt{font-weight:bold}dl dd{display:block;overflow:auto}body.mw-hide-empty-elt 
.mw-empty-elt{display:none}a{text-decoration:none;color:#002bb8}a:visited{color:#5a3696}a:active{color:#faa700}a:hover{text-decoration:underline}a.new,a.new:visited,a.new:hover{color:#dd}a.new
 > *,a.new:visited > *,a.new:hover > 
*{color:#dd}a.external{background-image:url(data:image/png;base64,iVBORw0KGgoNSUhEUgoKCAYAAACNMs+9VElEQVR42n3PgQkAIAhEUXdqJ3dqJ3e6IoTPUSQcgj4EQ5IlUiLE0Jil3PECXhcHGBhZ8kg4hwxAu3MZeCGeyFnAXp4hqNQPnt7QL0nADpD6wHccLvnAKksq8iiaAElFTkSuQmCC);background-image:url(/w/skins/MinervaNeue/resources/skins.minerva.content.styles/images/external-link-ltr-icon.png?948bf)!ie;background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3C%3Fxml
 version=%221.0%22 encoding=%22UTF-8%22%3F%3E%3Csvg 
xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22%3E%3Cpath 
fill=%22%23fff%22 stroke=%22%2336c%22 d=%22M.5 
3.518h5.982V9.5H.5z%22/%3E%3Cpath d=%22M4.755-.16H9.99v5.39L8.417 
6.774l-1.31-1.31L4.383 8.19 1.695 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Remove unused utility method

2018-01-18 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405218 )

Change subject: Hygiene: Remove unused utility method
..

Hygiene: Remove unused utility method

Change-Id: Iabbc7ca5def69d962f3f069f7d7cb94cfe6c3699
---
M lib/mwapi.js
M test/lib/mwapi/image-test.js
2 files changed, 0 insertions(+), 41 deletions(-)


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

diff --git a/lib/mwapi.js b/lib/mwapi.js
index f96edea..0750aa1 100644
--- a/lib/mwapi.js
+++ b/lib/mwapi.js
@@ -326,14 +326,6 @@
 return api.mwApiGet(app, req.params.domain, query);
 };
 
-mwapi.scaledThumbObj = function(thumb, originalWidth, desiredWidth) {
-const source = mwapi.scaledImageUrl(thumb.source, desiredWidth);
-const match = mwapi.WIDTH_IN_IMAGE_URL_REGEX.exec(source);
-const width = match ? parseInt(match[1], 10) : originalWidth;
-const height = Math.round(width * thumb.height / thumb.width);
-return { source, width, height };
-};
-
 /**
  * Scales a single image thumbnail URL to another size, if possible.
  * @param {!string} initialUrl the initial URL for an image
diff --git a/test/lib/mwapi/image-test.js b/test/lib/mwapi/image-test.js
index b820377..774f281 100644
--- a/test/lib/mwapi/image-test.js
+++ b/test/lib/mwapi/image-test.js
@@ -3,7 +3,6 @@
 const assert = require('../../utils/assert.js');
 const buildUrls = require('../../../lib/mwapi').buildLeadImageUrls;
 const scale = require('../../../lib/mwapi').scaledImageUrl;
-const scaledObj = require('../../../lib/mwapi').scaledThumbObj;
 
 const path = '//upload.wikimedia.org/wikipedia/commons/thumb/a/a0';
 const httpPath = 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/a0';
@@ -18,38 +17,6 @@
 `${prefix}/thumb/0/0b/Cat_poster_1.jpg/120px-Cat_poster_1.jpg`);
 assert.deepEqual(scale(`${prefix}/9/96/Vasskertentrance.jpg`, 320),
 `${prefix}/9/96/Vasskertentrance.jpg`);
-});
-
-it('thumb objects are scaled if the original image is scalable', () => {
-const prefix = 'https://upload.wikimedia.org/wikipedia/commons';
-const initialHasWidth = {
-source: 
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/1280px-Cat_poster_1.jpg`,
-width: 1280,
-height: 840
-};
-const initialNoWidth = {
-source: `${prefix}/9/96/Vasskertentrance.jpg`,
-width: 800,
-height: 533
-};
-assert.deepEqual(scaledObj(initialHasWidth, 5935, 320),
-{
-source: 
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/320px-Cat_poster_1.jpg`,
-width: 320,
-height: 210
-});
-assert.deepEqual(scaledObj(initialHasWidth, 5935, 1600),
-{
-source: 
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/1280px-Cat_poster_1.jpg`,
-width: 1280,
-height: 840
-});
-assert.deepEqual(scaledObj(initialNoWidth, 800, 320),
-{
-source: `${prefix}/9/96/Vasskertentrance.jpg`,
-width: 800,
-height: 533
-});
 });
 
 it('buildLeadImageUrls("a") should return all "a"s', () => {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabbc7ca5def69d962f3f069f7d7cb94cfe6c3699
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Update diff results for -wrapped references

2018-01-18 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405047 )

Change subject: Hygiene: Update diff results for -wrapped references
..

Hygiene: Update diff results for -wrapped references

Needed now that T45094 is deployed.

Change-Id: I0bdde8221cdcd04a39a75259c9aadc4f7cc98663
---
M 
test/diff/results/page_formatted-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
M 
test/diff/results/page_formatted-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_TitleLinkEncoding.json
M 
test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
M 
test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_TitleLinkEncoding.json
4 files changed, 10 insertions(+), 10 deletions(-)


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

diff --git 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index d3eb616..3dc7cf4 100644
--- 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -117,7 +117,7 @@
   },
   {
 "id": 14,
-"text": "\n\n\nShortcuts\nMOS:ORDERMOS:SECTIONORDER\nSee also: Wikipedia:Manual of Style §Section 
headings\n\nA simple article should have at least a lead section 
and references. As editors add complexity where required, the elements (such as 
sections and templates) that are used typically appear in the following order, 
although they would not all appear in the same article at the same time: 
\n Before the lead section\n Hatnotes\n Deletion/Protection tags 
(CSD, PROD, AFD, 
PP notices)\n Appendices[1]\n Works or 
publications (for biographies only)\n Foo\n 
{{featured list}}, 
{{featured 
article}} and {{good 
article}} (where appropriate for article status) 
\n Defaultsort\n Categories[2]\n\n",
+"text": "\n\n\nShortcuts\nMOS:ORDERMOS:SECTIONORDER\nSee also: Wikipedia:Manual of Style §Section 
headings\n\nA simple article should have at least a lead section 
and references. As editors add complexity where required, the elements (such as 
sections and templates) that are used typically appear in the following order, 
although they would not all appear in the same article at the same time: 
\n Before the lead section\n Hatnotes\n Deletion/Protection tags 
(CSD, PROD, AFD, 
PP notices)\n Appendices[1]\n Works or 
publications (for biographies only)\n Foo\n 
{{featured list}}, 
{{featured 
article}} and {{good 
article}} (where appropriate for article status) 
\n Defaultsort\n Categories[2]\n\n",
 "toclevel": 2,
 "line": "Order of article elements",
 "anchor": "Order_of_article_elements"
@@ -131,7 +131,7 @@
   },
   {
 "id": 16,
-"text": "\nFurther information: Wikipedia:Manual of Style §Section 
headings\n\nHeadings introduce sections and subsections, clarify 
articles by breaking up text, organize content, and populate the table of 
contents.\n\nHeadings follow a six-level hierarchy, starting at 1 
and ending at 6. The level of the heading is defined by the number of equal 
signs on either side of the title. Heading 1 
(=Heading1=) is automatically generated as the 
title of the article, and is never appropriate within the body of articles. 
Sections start at the second level 
(==Heading2==), with subsections at the third 
level (===Heading3===), and additional levels 
of subsections at the fourth level 
(Heading4), fifth level, and sixth 
level. Sections should be consecutive, such that they do not skip levels from 
sections to sub-subsections; the exact methodology is part of the Accessibility guideline.[3]\n\n",
+"text": "\nFurther information: Wikipedia:Manual of Style §Section 
headings\n\nHeadings introduce sections and subsections, clarify 
articles by breaking up text, organize content, and populate the table of 
contents.\n\nHeadings follow a six-level hierarchy, starting at 1 
and ending at 6. The level of the heading is defined by the number of equal 
signs on either side of the title. Heading 1 
(=Heading1=) is automatically generated as the 
title of the article, and is never appropriate within the body of articles. 
Sections start at the second level 
(==Heading2==), with subsections at the third 
level (===Heading3===), and additional levels 
of subsections at the fourth level 
(Heading4), fifth level, and sixth 
level. Sections should be consecutive, such that they do not skip levels from 
sections to sub-subsections; the exact methodology is part of the Accessibility guideline.[3]\n\n",
 "toclevel": 3,
 "line": "Headings and sections",
 "anchor": 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Stop filtering PNGs and SVGs by type

2018-01-18 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405009 )

Change subject: Media: Stop filtering PNGs and SVGs by type
..

Media: Stop filtering PNGs and SVGs by type

Bug: T177430
Change-Id: I413f04bc61096eb551351518f3692ef64ad8b2b2
---
M lib/media.js
M test/diff/results/page_media-enwiki-Hummingbird.json
M test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
M test/lib/media/media-test-inclusion.js
4 files changed, 982 insertions(+), 58 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index cb309b5..7c02672 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -1,6 +1,7 @@
 'use strict';
 
 const domino = require('domino');
+const underscore = require('underscore');
 const api = require('./api-util');
 const Title = require('mediawiki-title').Title;
 const Selectors = require('./selectors').MediaSelectors;
@@ -56,7 +57,7 @@
 const doc = domino.createDocument(html);
 // todo: handle Mathoid-rendered math images
 const elems = doc.querySelectorAll(Selectors.join()).filter(e => 
!e.closest(Blacklist.join()));
-return [].map.call(elems, (elem) => {
+const results = [].map.call(elems, (elem) => {
 const mediaType = getMediaType(elem);
 const resource = mediaType.selector && 
elem.querySelector(mediaType.selector);
 const figCaption = elem.querySelector('figcaption');
@@ -117,6 +118,7 @@
 sources
 };
 });
+return underscore.uniq(results, elem => elem.title);
 }
 
 /**
@@ -133,6 +135,8 @@
 const info =  item.imageinfo[0];
 const meta = info.metadata && metadataToObject(info.metadata);
 const ext = info.extmetadata;
+const isAudio = info.mediatype === 'AUDIO';
+const isSvg = info.mime && info.mime.includes('svg');
 const canonical = Title.newFromText(item.title, 
siteinfo).getPrefixedDBKey();
 return {
 titles: {
@@ -148,8 +152,8 @@
 },
 original: {
 source: info.url,
-width: info.mediatype === 'AUDIO' ? undefined : info.width,
-height: info.mediatype === 'AUDIO' ? undefined : info.height,
+width: isAudio || isSvg ? undefined : info.width,
+height: isAudio || isSvg ? undefined : info.height,
 mime: info.mime,
 },
 page_count: info.pagecount,
@@ -166,13 +170,11 @@
 
 function filterResult(item) {
 // Reject gallery items if they're too small.
-// Also reject SVG and PNG items by default, because they're likely to be
-// logos and/or presentational images.
+const isAudio = item.type === Audio.name;
+const isSvg = item.original && item.original.mime && 
item.original.mime.includes('svg');
 return item.sources || item.original && item.original.source
-&& (item.type === Audio.name || item.original.width >= MIN_IMAGE_SIZE)
-&& (item.type === Audio.name || item.original.height >= MIN_IMAGE_SIZE)
-&& !item.original.mime.includes('svg')
-&& !item.original.mime.includes('png');
+&& (isAudio || isSvg || item.original.width >= MIN_IMAGE_SIZE)
+&& (isAudio || isSvg || item.original.height >= MIN_IMAGE_SIZE);
 }
 
 /**
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index 9b91c9a..b448dbf 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -172,6 +172,34 @@
   "description": "Calliope Hummingbird / Stellula calliope - female 
feeding two chicks"
 },
 {
+  "section_id": 15,
+  "type": "image",
+  "gallery_id": "mwARU",
+  "titles": {
+"canonical": "File:AnnasHummingbird-NestCollage.png",
+"normalized": "File:AnnasHummingbird-NestCollage.png",
+"display": "File:AnnasHummingbird-NestCollage.png"
+  },
+  "thumbnail": {
+"source": 
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/AnnasHummingbird-NestCollage.png/320px-AnnasHummingbird-NestCollage.png;,
+"width": 320,
+"height": 239,
+"mime": "image/png"
+  },
+  "original": {
+"source": 
"https://upload.wikimedia.org/wikipedia/commons/4/44/AnnasHummingbird-NestCollage.png;,
+"width": 5183,
+"height": 3863,
+"mime": "image/png"
+  },
+  "file_page": 
"https://commons.wikimedia.org/wiki/File:AnnasHummingbird-NestCollage.png;,
+  "artist": "FA 
Seidman",
+  "credit": "Own work",
+  "license": "CC0",
+  "license_url": 
"http://creativecommons.org/publicdomain/zero/1.0/deed.en;,
+  "description": "This is a collage of photographs of an Anna's 
Hummingbird nest that fell from a tree in Ventura County, California. The 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Filter images based on size on the page

2018-01-18 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405010 )

Change subject: Media: Filter images based on size on the page
..

Media: Filter images based on size on the page

Reject if on-page width or height < 64px.

Bug: T177430
Change-Id: I9e6521b2b0ab579b97ef852e91c7517be6ff15a5
---
M lib/media.js
M test/diff/results/page_media-enwiki-Hummingbird.json
M test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
M test/lib/media/media-test-inclusion.js
M test/lib/media/media-test-metadata.js
5 files changed, 27 insertions(+), 578 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index 7c02672..d7b9bf7 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -47,6 +47,16 @@
 }
 }
 
+function isDisallowed(elem) {
+return !!(elem.closest(Blacklist.join()));
+}
+
+function isTooSmall(img) {
+const width = img.getAttribute('width');
+const height = img.getAttribute('height');
+return width < MIN_IMAGE_SIZE || height < MIN_IMAGE_SIZE;
+}
+
 /**
  * Get file page titles from a NodeList of media elements from Parsoid HTML
  * @param {!String} html raw Parsoid HTML
@@ -56,7 +66,11 @@
 function getMediaItemInfoFromPage(html) {
 const doc = domino.createDocument(html);
 // todo: handle Mathoid-rendered math images
-const elems = doc.querySelectorAll(Selectors.join()).filter(e => 
!e.closest(Blacklist.join()));
+const elems = doc.querySelectorAll(Selectors.join()).filter((elem) => {
+const mediaType = getMediaType(elem);
+const resource = mediaType.selector && 
elem.querySelector(mediaType.selector);
+return !isDisallowed(elem) && (mediaType === Image ? 
!isTooSmall(resource) : true);
+});
 const results = [].map.call(elems, (elem) => {
 const mediaType = getMediaType(elem);
 const resource = mediaType.selector && 
elem.querySelector(mediaType.selector);
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index b448dbf..1f3aabb 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -1006,75 +1006,6 @@
   "license": "CC BY-SA 4.0",
   "license_url": "https://creativecommons.org/licenses/by-sa/4.0;,
   "description": "A female Anna's Hummingbird Calypte anna perched on a small branch."
-},
-{
-  "section_id": 32,
-  "type": "image",
-  "titles": {
-"canonical": "File:Lock-green.svg",
-"normalized": "File:Lock-green.svg",
-"display": "File:Lock-green.svg"
-  },
-  "thumbnail": {
-"source": 
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/320px-Lock-green.svg.png;,
-"width": 320,
-"height": 508,
-"mime": "image/png"
-  },
-  "original": {
-"source": 
"https://upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg;,
-"mime": "image/svg+xml"
-  },
-  "file_page": "https://commons.wikimedia.org/wiki/File:Lock-green.svg;,
-  "artist": "User:Trappist the monk",
-  "credit": "https://en.wikipedia.org/wiki/File:Free-to-read_lock_75.svg\; 
class=\"extiw\" title=\"en:File:Free-to-read lock 
75.svg\">en:File:Free-to-read_lock_75.svg",
-  "license": "CC0",
-  "license_url": 
"http://creativecommons.org/publicdomain/zero/1.0/deed.en;,
-  "description": "Copy of https://en.wikipedia.org/wiki/File:Free-to-read_lock_75.svg\; 
class=\"extiw\" title=\"en:File:Free-to-read lock 
75.svg\">en:File:Free-to-read_lock_75.svg, with consistent name for the 
series of locks"
-},
-{
-  "section_id": 33,
-  "type": "image",
-  "titles": {
-"canonical": "File:Folder_Hexagonal_Icon.svg",
-"normalized": "File:Folder Hexagonal Icon.svg",
-"display": "File:Folder Hexagonal Icon.svg"
-  },
-  "thumbnail": {
-"source": 
"https://upload.wikimedia.org/wikipedia/en/thumb/4/48/Folder_Hexagonal_Icon.svg/320px-Folder_Hexagonal_Icon.svg.png;,
-"width": 320,
-"height": 276,
-"mime": "image/png"
-  },
-  "original": {
-"source": 
"https://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg;,
-"mime": "image/svg+xml"
-  },
-  "file_page": 
"https://commons.wikimedia.org/wiki/File:Folder_Hexagonal_Icon.svg;,
-  "license": "Cc-by-sa-3.0",
-  "license_url": "https://creativecommons.org/licenses/by-sa/3.0/;
-},
-{
-  "section_id": 33,
-  "type": "image",
-  "titles": {
-"canonical": "File:Portal-puzzle.svg",
-"normalized": "File:Portal-puzzle.svg",
-"display": "File:Portal-puzzle.svg"
-  },
-  "thumbnail": {
-"source": 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Fix test

2018-01-17 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404905 )

Change subject: Hygiene: Fix test
..

Hygiene: Fix test

Needs updating due to a change in the page content.

Change-Id: I6cd0e7683aea298b19d1baa03882e1eddc266f65
---
M test/features/featured-image/pagecontent.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/test/features/featured-image/pagecontent.js 
b/test/features/featured-image/pagecontent.js
index 4b7cfdd..57264c5 100644
--- a/test/features/featured-image/pagecontent.js
+++ b/test/features/featured-image/pagecontent.js
@@ -40,7 +40,7 @@
 assert.equal(res.body.title, 'File:Kazakhstan Altay 3.jpg');
 assert.equal(res.body.thumbnail.source, 
'https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Kazakhstan_Altay_3.jpg/640px-Kazakhstan_Altay_3.jpg');
 assert.equal(res.body.image.source, 
'https://upload.wikimedia.org/wikipedia/commons/9/99/Kazakhstan_Altay_3.jpg');
-assert.contains(res.body.description.text, 'Altay mountains');
+assert.contains(res.body.description.text, 'Altai Mountains');
 assert.equal(res.body.description.lang, 'en');
 });
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cd0e7683aea298b19d1baa03882e1eddc266f65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Update diff results to fix tests

2018-01-17 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404770 )

Change subject: Hygiene: Update diff results to fix tests
..

Hygiene: Update diff results to fix tests

Change-Id: I29769e73f3d4559c8adea4651a00f84c6dc43323
---
M 
test/diff/results/page_formatted-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
M 
test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index 35f0b31..d3eb616 100644
--- 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -54,7 +54,7 @@
   },
   {
 "id": 5,
-"text": "\n\n\n\n\n\n",
+"text": "\n\n\n\n\n\n",
 "toclevel": 1,
 "line": "Musical notation",
 "anchor": "Musical_notation"
diff --git 
"a/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index c01ada5..c41b638 100644
--- 
"a/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -208,7 +208,7 @@
   },
   {
 "id": 5,
-"text": "\n\n\n\n\n\n",
+"text": "\n\n\n\n\n\n",
 "toclevel": 1,
 "line": "Musical notation",
 "anchor": "Musical_notation"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29769e73f3d4559c8adea4651a00f84c6dc43323
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Add large test to verify featured-image results

2018-01-17 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404769 )

Change subject: Add large test to verify featured-image results
..

Add large test to verify featured-image results

Change-Id: I34c68de0134a9975d6bfb34308c27bddb9c03837
---
A test/features/featured-image/featured-image-large.js
1 file changed, 58 insertions(+), 0 deletions(-)


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

diff --git a/test/features/featured-image/featured-image-large.js 
b/test/features/featured-image/featured-image-large.js
new file mode 100644
index 000..4223d8e
--- /dev/null
+++ b/test/features/featured-image/featured-image-large.js
@@ -0,0 +1,58 @@
+'use strict';
+
+const preq = require('preq');
+const assert = require('../../utils/assert.js');
+const server = require('../../utils/server.js');
+const testUtil = require('../../utils/testUtil.js');
+
+const languages = ['en']; // TODO: Make this configurable
+
+// Note: to run large tests set the env variable LARGE_TESTS to any string
+describe.only('featured-image-large', function() {
+
+this.timeout(2); // eslint-disable-line no-invalid-this
+
+before(() => {
+return server.start();
+});
+
+function uriForLang(dateString, lang = 'en') {
+const baseUri = 
`${server.config.uri}${lang}.wikipedia.org/v1/media/image/featured`;
+return `${baseUri}/${dateString}`;
+}
+
+function verify(res, lang, uri) {
+assert.ok(res.status === 200);
+assert.ok(res.body.title.length, `${uri} has no title`);
+assert.ok(res.body.description, `${uri} has no description`);
+assert.ok(res.body.description.text.length, `${uri} has no description 
text`);
+assert.ok(res.body.description.lang.length, `${uri} has no description 
lang`);
+assert.ok(res.body.thumbnail, `${uri} returns no thumbnail info`);
+assert.ok(res.body.thumbnail.source.length, `${uri} has no thumbnail 
source URI`);
+assert.ok(!isNaN(res.body.thumbnail.width), `${uri} thumbnail has 
invalid width`);
+assert.ok(!isNaN(res.body.thumbnail.height), `${uri} thumbnail has 
invalid width`);
+assert.ok(res.body.image, `${uri} returns no original image info`);
+assert.ok(res.body.image.source.length, `${uri} has no original source 
URI`);
+assert.ok(!isNaN(res.body.image.width), `${uri} original has invalid 
width`);
+assert.ok(!isNaN(res.body.image.height), `${uri} original has invalid 
width`);
+}
+
+function fetchAndVerify(lang, dateString) {
+const uri = uriForLang(dateString, lang);
+return preq.get(uri).then(res => verify(res, lang, uri));
+}
+
+if (process.env.LARGE_TESTS) {
+for (const lang of languages) {
+for (const date = new Date(Date.UTC(2016, 0, 1));
+date < new Date();
+date.setUTCDate(date.getUTCDate() + 1)) {
+
+const dateString = testUtil.constructTestDate(date);
+it(`${lang}: ${dateString}`, () => {
+return fetchAndVerify(lang, dateString);
+});
+}
+}
+}
+});

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34c68de0134a9975d6bfb34308c27bddb9c03837
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Refine description selection

2018-01-16 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404534 )

Change subject: Refine description selection
..

Refine description selection

Simplifies the description picking logic away from its current two-step
approach a single step.

Additionally, drops the secondary fallback behavior of returning the first
available description in the event a description is not available in either
the preferred language or the configured fallback (English), since users
are not likely to have any use for a description in a totally random
language.

Change-Id: Idc86f90674ef1bee4f664b8058ed105d97f4
---
M lib/feed/featured-image.js
M test/lib/feed/featured-image-unit.js
2 files changed, 24 insertions(+), 31 deletions(-)


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

diff --git a/lib/feed/featured-image.js b/lib/feed/featured-image.js
index 94ffbf5..74e58f5 100644
--- a/lib/feed/featured-image.js
+++ b/lib/feed/featured-image.js
@@ -15,6 +15,7 @@
 const HTTPError = sUtil.HTTPError;
 
 const COMMONS_URL = 'commons.wikimedia.org';
+const DESCRIPTION_FALLBACK_LANG = 'en';
 
 /**
  * @prop {!string} lang Localization language
@@ -70,29 +71,25 @@
 return page;
 }
 /**
- * POTD caption language from Parsoid HTML, if available.
+ * Picture of the Day caption from Parsoid HTML, if available.
  * @param {?Object} descriptions POTD captions via the Picture of the Day 
template,
  *   parsed from the page HTML. Requires that the input be an object of the 
form
  *   { "en": "foo", "de": "bar" }.
- * @param {!String} lang the desired description language
- * @return {?String} the description language to use
+ * @param {!String} preferredLang the desired description language
+ * @return {?Description} the resolved caption, if available
  */
-function pickDescriptionLang(descriptions, lang) {
+function getDescription(descriptions, preferredLang) {
 if (!(descriptions && typeof (descriptions) === 'object')) {
 return;
 }
 
-const fallbackLang = 'en';
-
-if (descriptions[lang]) {
-return lang;
+if (descriptions[preferredLang]) {
+return new Description(preferredLang, descriptions[preferredLang]);
 }
 
-if (descriptions[fallbackLang]) {
-return fallbackLang;
+if (descriptions[DESCRIPTION_FALLBACK_LANG]) {
+return new Description(DESCRIPTION_FALLBACK_LANG, 
descriptions[DESCRIPTION_FALLBACK_LANG]);
 }
-
-return Object.keys(descriptions)[0];
 }
 
 function buildPayload(page, lang) {
@@ -183,13 +180,7 @@
 }).then((response) => {
 const doc = domino.createDocument(response.body);
 removeLangLabels(doc);
-const descriptions = queryDescriptions(doc);
-
-// todo: should we just send all langs like parsoid does?
-const resolvedLang = pickDescriptionLang(descriptions, lang);
-if (resolvedLang) {
-ret.payload.description = new Description(resolvedLang, 
descriptions[resolvedLang]);
-}
+ret.payload.description = getDescription(queryDescriptions(doc), lang);
 return ret;
 }).catch((err) => {
 if (err.status === 504) {
@@ -211,6 +202,6 @@
 module.exports = {
 promise,
 testing: {
-pickDescriptionLang
+getDescription
 }
 };
diff --git a/test/lib/feed/featured-image-unit.js 
b/test/lib/feed/featured-image-unit.js
index be7c5d1..576037f 100644
--- a/test/lib/feed/featured-image-unit.js
+++ b/test/lib/feed/featured-image-unit.js
@@ -2,27 +2,29 @@
 
 const assert = require('../../utils/assert');
 const featuredImage = require('../../../lib/feed/featured-image'); // module 
under test
-const pickDescriptionLang = featuredImage.testing.pickDescriptionLang;
+const getDescription = featuredImage.testing.getDescription;
 
 describe('featured-image-unit', () => {
 
-it('pickDescriptionLang resolves to lang if present', () => {
-const result = pickDescriptionLang({ 'en':'foo','de':'bar' }, 'de');
-assert.deepEqual(result, 'de');
+it('getDescription returns description for preferred lang if present', () 
=> {
+const result = getDescription({ 'en':'foo','de':'bar' }, 'de');
+assert.deepEqual(result.lang, 'de');
+assert.deepEqual(result.text, 'bar');
 });
 
-it('pickDescriptionLang falls back to en if lang not present', () => {
-const result = pickDescriptionLang({ 'en':'foo','de':'bar' }, 'ja');
-assert.deepEqual(result, 'en');
+it('getDescription falls back to en description if preferred lang not 
present', () => {
+const result = getDescription({ 'en':'foo','de':'bar' }, 'ja');
+assert.deepEqual(result.lang, 'en');
+assert.deepEqual(result.text, 'foo');
 });
 
-it('pickDescriptionLang returns undefined for non-object input', () => {
-const result = pickDescriptionLang("lol", 'zh');
+

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Stop rewriting m.wikipedia.org and zero.wikipedia.org

2018-01-14 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404158 )

Change subject: Stop rewriting m.wikipedia.org and zero.wikipedia.org
..

Stop rewriting m.wikipedia.org and zero.wikipedia.org

Special Apache rules exist for m.wikipedia.org and zero.wikipedia.org
to redirect to mobilelanding.php in support of Wikipedia Zero. However,
these rules are currently unreachable because requests for these hosts
are rewritten in Varnish to bare wikipedia.org due to an unrelated change.
See details at https://phabricator.wikimedia.org/T69015#3761037.

This patch restores the old behavior, which preserves the m. and zero.
subdomains for wikipedia.org when there is no preceding language subdomain
(such as en.).

Partially reverts 27119b97d628aaa7fa32423d69986bdc693699b5 but preserves
and updates the tests added in that commit.

Bug: T69015
Change-Id: Ica54a54e78b02375f92b3bc328e0c6aa8544aeb1
---
M modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc
M modules/varnish/templates/text-frontend.inc.vcl.erb
2 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/58/404158/1

diff --git a/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc 
b/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc
index c1874cd..204ee0f 100644
--- a/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc
+++ b/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc
@@ -18,7 +18,7 @@
 txresp
 
 rxreq
-expect req.http.x-dt-host == "wikipedia.org"
+expect req.http.x-dt-host == "m.wikipedia.org"
 txresp
 
 rxreq
diff --git a/modules/varnish/templates/text-frontend.inc.vcl.erb 
b/modules/varnish/templates/text-frontend.inc.vcl.erb
index a63240f..7c15b31 100644
--- a/modules/varnish/templates/text-frontend.inc.vcl.erb
+++ b/modules/varnish/templates/text-frontend.inc.vcl.erb
@@ -86,24 +86,22 @@
call tag_carrier;
}
 
-   // Rewrite mobile hostnames to desktop hostnames as 
x-dt-host. All
-   // hostnames are being rewritten by the regex in the 
final else
-   // clause, except for m.mediawiki.org and 
m.wikidata.org which are
-   // rewritten here (because of the www.).
+   // Rewrite mobile hostnames to desktop hostnames as 
x-dt-host.
if (req.http.host == "m.mediawiki.org") {
set req.http.x-dt-host = "www.mediawiki.org";
+   } else if (req.http.host == 
"m.wikimediafoundation.org") {
+   set req.http.x-dt-host = 
"wikimediafoundation.org";
+   } else if (req.http.host == "m.wikisource.org") {
+   set req.http.x-dt-host = "wikisource.org";
} else if (req.http.host == "m.wikidata.org") {
set req.http.x-dt-host = "www.wikidata.org";
} else {
-   // All other hostnames are taken care of here.
// Replace .(m|zero)..org by 
..org
-   // as well as (m|zero)..org by 
.org
//
// Example:
-   // m.wikimediafoundation.org -> 
wikimediafoundation.org
// it.m.wikipedia.org -> it.wikipedia.org
// en.zero.wikipedia.org -> en.wikipedia.org
-   set req.http.x-dt-host = regsub(req.http.host, 
"^([a-z0-9-]+\.)?(m|zero)\.", "\1");
+   set req.http.x-dt-host = regsub(req.http.host, 
"^([a-z0-9-]+)\.(m|zero)\.", "\1.");
}
 
if (req.url ~ "^/api/rest_v1/") {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica54a54e78b02375f92b3bc328e0c6aa8544aeb1
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...ZeroPortal[master]: Only return info for enabled carriers from API type=carriers

2018-01-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404095 )

Change subject: Only return info for enabled carriers from API type=carriers
..

Only return info for enabled carriers from API type=carriers

Varnish obtains the set of carriers and IP ranges for which to perform
header enrichment from the zeroportal API module via the periodically-
run zerofetch.py script.[1] This API module currently returns information
on both enabled and disabled carriers, and varnish adds Zero-related
headers for requests from configured IP ranges for enabled and disabled
carriers alike.

This is currently causing trouble because we are blocking users with Zero
IPs from accessing uploaded files in Phabricator (e.g., all images). This
block is currently mistakenly affecting users on previously active but
currently disabled carriers.

This updates the API module to return info only for currently enabled
carriers for the relevant request.

[1] 
https://phabricator.wikimedia.org/source/operations-puppet/browse/production/modules/varnish/files/zerofetch.py

Bug: T173537
Change-Id: I26d14fcb807168cd5062f394d8d42ae2b2c9b116
---
M includes/ApiZeroPortal.php
1 file changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroPortal 
refs/changes/95/404095/1

diff --git a/includes/ApiZeroPortal.php b/includes/ApiZeroPortal.php
index 674d451..f75ba95 100644
--- a/includes/ApiZeroPortal.php
+++ b/includes/ApiZeroPortal.php
@@ -72,12 +72,14 @@
case 'carriers':
$processor = function ( ZeroConfig $content, 
$title ) use ( $result, $moduleName ) {
foreach ( $content->getIpsets() as 
$name => $ipset ) {
-   $result->addValue(
-   $moduleName,
-   $name === 'default' ? 
$title : $title . '|' . $name,
-   $ipset,
-   ApiResult::NO_SIZE_CHECK
-   );
+   if ( $content->enabled() ) {
+   $result->addValue(
+   $moduleName,
+   $name === 
'default' ? $title : $title . '|' . $name,
+   $ipset,
+   
ApiResult::NO_SIZE_CHECK
+   );
+   }
}
};
break;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I26d14fcb807168cd5062f394d8d42ae2b2c9b116
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ZeroPortal
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Fix POTD test

2018-01-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403981 )

Change subject: Hygiene: Fix POTD test
..

Hygiene: Fix POTD test

For some reason this test was changed at some point to request an
image that in fact has extmetadata, including ImageDescription. This
changes it back so it tests what it says it tests.

Change-Id: Ibe40bd56ac6f2cd371826a616ee185c1318360cd
---
M test/features/featured-image/pagecontent.js
1 file changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/test/features/featured-image/pagecontent.js 
b/test/features/featured-image/pagecontent.js
index 4b7cfdd..e9ccecd 100644
--- a/test/features/featured-image/pagecontent.js
+++ b/test/features/featured-image/pagecontent.js
@@ -32,15 +32,15 @@
 });
 });
 
-it('featured image with no extmetadata should have expected properties', 
() => {
-const uri = 
`${server.config.uri}en.wikipedia.org/v1/media/image/featured/2016/05/06`;
+it('description should be found for image with no extmetadata', () => {
+const uri = 
`${server.config.uri}en.wikipedia.org/v1/media/image/featured/2016/05/23`;
 return preq.get({ uri })
 .then((res) => {
 assert.status(res, 200);
-assert.equal(res.body.title, 'File:Kazakhstan Altay 3.jpg');
-assert.equal(res.body.thumbnail.source, 
'https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Kazakhstan_Altay_3.jpg/640px-Kazakhstan_Altay_3.jpg');
-assert.equal(res.body.image.source, 
'https://upload.wikimedia.org/wikipedia/commons/9/99/Kazakhstan_Altay_3.jpg');
-assert.contains(res.body.description.text, 'Altay mountains');
+assert.equal(res.body.title, 'File:Fra et romersk 
osteria.jpg');
+assert.equal(res.body.thumbnail.source, 
'https://upload.wikimedia.org/wikipedia/commons/thumb/7/7a/Fra_et_romersk_osteria.jpg/640px-Fra_et_romersk_osteria.jpg');
+assert.equal(res.body.image.source, 
'https://upload.wikimedia.org/wikipedia/commons/7/7a/Fra_et_romersk_osteria.jpg');
+assert.contains(res.body.description.text, 'Roman Osteria');
 assert.equal(res.body.description.lang, 'en');
 });
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe40bd56ac6f2cd371826a616ee185c1318360cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Dev: Add pre-commit dev dependency

2018-01-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403854 )

Change subject: Dev: Add pre-commit dev dependency
..

Dev: Add pre-commit dev dependency

On MacOS the package.json pre-commit directive Just Worked somehow but on
Ubuntu I guess it requires a dev dependency.

Change-Id: Ibf7a18338b59af8615785d7cf5b6f81bf35cc779
---
M package.json
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/package.json b/package.json
index 86086cb..adb9e56 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,8 @@
 "eslint-plugin-jsdoc": "^3.0.0",
 "rss-parser": "^2.10.8",
 "sepia": "^2.0.2",
-"sinon": "^4.1.2"
+"sinon": "^4.1.2",
+"pre-commit": "^1.2.2"
   },
   "deploy": {
 "target": "debian",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf7a18338b59af8615785d7cf5b6f81bf35cc779
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: WIP: Quick and dirty paren stripping, without regexes

2018-01-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403776 )

Change subject: WIP: Quick and dirty paren stripping, without regexes
..

WIP: Quick and dirty paren stripping, without regexes

Not pretty but gets the job done. ;)

Handles all but a handful of Asian language edge cases where different
rules apply.

Change-Id: Ia581e2268495465a6adf1b24475d3d1d5f90c898
---
M lib/transformations/summarize.js
M test/lib/transformations/summarize.js
2 files changed, 69 insertions(+), 35 deletions(-)


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

diff --git a/lib/transformations/summarize.js b/lib/transformations/summarize.js
index e0becc8..6872a51 100644
--- a/lib/transformations/summarize.js
+++ b/lib/transformations/summarize.js
@@ -4,21 +4,65 @@
 const flattenElements = require('./flattenElements');
 const rmElementsWithSelector = require('./rmElementsWithSelector');
 const removeAttributes = require('./removeAttributes');
+const NodeType = require('../nodeType');
 
-/**
- * Recursively discard any parentheticals that themselves are inside 
parentheticals
- * @param {string} html
- * @return {string} html summary with nested parentheticals removed.
- */
-function removeNestedParentheticals(html) {
-// Remove any nested parentheticals
-const regex = /(\([^()]+)(\([^()]+\))/g;
-const newHtml = html.replace(regex, '$1 ');
+function removeParens(doc) {
+const childNodes = doc.querySelector('body > p') ? doc.querySelector('body 
> p').childNodes : doc.body.childNodes; // eslint-disable-line max-len
+let parensStart;
+let level = 0;
+let remove = false;
+for (let i = 0; i < childNodes.length; i++) {
+const cur = childNodes[i];
+if (cur.nodeType === NodeType.TEXT_NODE) {
+let text = cur.textContent;
+for (let j = 0; j < text.length; j++) {
+const char = text.charAt(j);
+if (char === '(' || char === '(') {
+level++;
+if (parensStart) {
+remove = true;
+} else {
+parensStart = [i, j];
+}
+} else if (char === ' ') {
+if (parensStart && !(i === parensStart[0] && j === 
parensStart[1] + 1)) {
+remove = true;
+}
+} else if (char === ')' || char === ')') {
+level--;
+if (level === 0 && remove) {
+const parensStartNode = parensStart[0];
+const parensStartPos = parensStart[1];
 
-if (newHtml.match(regex)) {
-return removeNestedParentheticals(newHtml);
-} else {
-return newHtml;
+if (i === parensStartNode) {
+text = cur.textContent.substring(0, 
parensStartPos) + cur.textContent.substring(j + 1); // eslint-disable-line 
max-len
+cur.textContent = text;
+parensStart = undefined;
+j = 0;
+remove = false;
+continue;
+}
+
+childNodes[parensStartNode].textContent = 
childNodes[parensStartNode].textContent.substring(0, parensStartPos); // 
eslint-disable-line max-len
+for (let k = parensStartNode + 1; k < i; k++) {
+if (childNodes[k]) {
+childNodes[k].mw_remove = true;
+}
+}
+text = text.substring(j + 1);
+cur.textContent = text;
+parensStart = undefined;
+j = 0;
+remove = false;
+}
+}
+}
+}
+}
+for (let i = childNodes.length - 1; i > -1; i--) {
+if (childNodes[i].mw_remove) {
+childNodes[i].parentNode.removeChild(childNodes[i]);
+}
 }
 }
 
@@ -36,22 +80,12 @@
 rmElementsWithSelector(doc, '.noprint');
 rmElementsWithSelector(doc, 'math');
 rmElementsWithSelector(doc, 'span:empty,b:empty,i:empty,p:empty');
+removeParens(doc);
 
 html = doc.body.innerHTML;
-html = removeNestedParentheticals(html);
-// 1. Replace any parentheticals which have at least one space inside
-html = html.replace(/\([^\)]+ [^\)]+\)/g, ' '); // eslint-disable-line 
no-useless-escape
-// 2. Remove any empty parentheticals due to transformations
-html = html.replace(/\(\)/g, ' ');
-
-// 3. Remove content inside any other non-latin parentheticals. The 
behaviour is
-// the same as 1 but for languages that are not latin based
-html = 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix lint issues

2018-01-11 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403578 )

Change subject: Fix lint issues
..


Fix lint issues

Change-Id: I5dbf10b3479856a9e35d2fa32895373f63b577f4
---
M test/lib/mobile-util/mobile-util-test.js
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Mholloway: Verified; Looks good to me, approved



diff --git a/test/lib/mobile-util/mobile-util-test.js 
b/test/lib/mobile-util/mobile-util-test.js
index bbc000b..0665cf1 100644
--- a/test/lib/mobile-util/mobile-util-test.js
+++ b/test/lib/mobile-util/mobile-util-test.js
@@ -31,8 +31,9 @@
 });
 
 it('getSummaryType identifies main and disambig pages, defaults to 
\'standard\'', () => {
-assert.deepEqual(mUtil.getSummaryType({"mainpage":true}), 'mainpage');
-
assert.deepEqual(mUtil.getSummaryType({"pageprops":{"disambiguation":""}}), 
'disambiguation');
+assert.deepEqual(mUtil.getSummaryType({ "mainpage": true }), 
'mainpage');
+assert.deepEqual(mUtil.getSummaryType({ "pageprops": { 
"disambiguation": "" } }),
+'disambiguation');
 assert.deepEqual(mUtil.getSummaryType({}), 'standard');
 });
 });

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5dbf10b3479856a9e35d2fa32895373f63b577f4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: BearND 
Gerrit-Reviewer: Fjalapeno 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: Mhurd 
Gerrit-Reviewer: Ppchelko 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Dev: send no-cache header with diff test requests

2018-01-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403637 )

Change subject: Dev: send no-cache header with diff test requests
..

Dev: send no-cache header with diff test requests

Hopefully this will reduce the disruption caused by things like template
changes.

Change-Id: Ib3c7132d4f47c34ce50a8cdb4f361c5adb267bcc
---
M test/diff/diff.js
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/test/diff/diff.js b/test/diff/diff.js
index dc3075f..85ff7d9 100644
--- a/test/diff/diff.js
+++ b/test/diff/diff.js
@@ -49,7 +49,8 @@
 // Verify step:
 for (const spec of testSpec.TEST_SPECS) {
 it(`${spec.testName()}`, () => {
-return preq.get({ uri: buildUri(spec.uriPath()) })
+return preq.get({ uri: buildUri(spec.uriPath()),
+  headers: 'cache-control: no-cache' })
.then((rsp) => {
const content = 
fs.readFileSync(spec.filePath(), 'utf8');
spec.postProcessing(rsp);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3c7132d4f47c34ce50a8cdb4f361c5adb267bcc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Guard against unexpected ImageDescription extmetadata values

2018-01-10 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403575 )

Change subject: Guard against unexpected ImageDescription extmetadata values
..

Guard against unexpected ImageDescription extmetadata values

ImageDescription, like all extmetadata fields, can contain anything.
It's a mistake to assume that it will take the form of a key-value
object.

This guards against unexpected input.

Bug: T184669
Change-Id: I502a2b03109686d6a23c124b814eff92b75bb8c1
---
M lib/feed/featured-image.js
M test/features/featured-image/pagecontent.js
2 files changed, 26 insertions(+), 2 deletions(-)


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

diff --git a/lib/feed/featured-image.js b/lib/feed/featured-image.js
index fd04030..79ee550 100644
--- a/lib/feed/featured-image.js
+++ b/lib/feed/featured-image.js
@@ -87,6 +87,18 @@
 return Object.keys(descriptions)[0];
 }
 
+/**
+ * Resolved description language from the extmetadata ImageDescription field, 
if
+ * available. Requires that the input be an object of the form 
{"en":"foo","de":"bar"}.
+ * If not, will return undefined or false.
+ * @param {?Object} input extmetadata ImageDescription value (may be undefined)
+ * @param {!String} lang the request language
+ * @return {?String|Boolean} the description language to use
+ */
+function resolvedLangFromImageDescription(input, lang) {
+return input && (typeof (input) === 'object' || undefined) && 
pickDescriptionLang(input, lang);
+}
+
 function buildPayload(page, lang) {
 if (!page || page.notfound) {
 return undefined;
@@ -118,7 +130,7 @@
 }
 
 const descriptions = imageinfo.extmetadata.ImageDescription.value;
-const resolvedLang = descriptions && pickDescriptionLang(descriptions, 
lang);
+const resolvedLang = resolvedLangFromImageDescription(descriptions, lang);
 if (resolvedLang) {
 payload.description = new Description(resolvedLang, 
descriptions[resolvedLang]);
 }
@@ -210,5 +222,8 @@
 }
 
 module.exports = {
-promise
+promise,
+testing: {
+resolvedLangFromImageDescription
+}
 };
diff --git a/test/features/featured-image/pagecontent.js 
b/test/features/featured-image/pagecontent.js
index 4b7cfdd..a77e832 100644
--- a/test/features/featured-image/pagecontent.js
+++ b/test/features/featured-image/pagecontent.js
@@ -83,6 +83,15 @@
 });
 });
 
+it('should return english description where ImageDescription value is 
unexpected type', () => {
+const uri = 
`${server.config.uri}zh.wikipedia.org/v1/media/image/featured/2018/01/10`;
+return preq.get({uri})
+.then((res) => {
+assert.contains(res.body.description.text, 'Motosacoche');
+assert.deepEqual(res.body.description.lang, 'en');
+});
+});
+
 it('featured image of an old date should return 404', () => {
 const uri = 
`${server.config.uri}en.wikipedia.org/v1/media/image/featured/1970/12/31`;
 return preq.get({ uri })

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I502a2b03109686d6a23c124b814eff92b75bb8c1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Split getSummaryType into standalone method and add...

2018-01-10 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403553 )

Change subject: Hygiene: Split getSummaryType into standalone method and add 
unit tests
..

Hygiene: Split getSummaryType into standalone method and add unit tests

Change-Id: Ibd73ce5363719769d921957d8358c68fecf493e6
---
M lib/mobile-util.js
M test/lib/mobile-util/mobile-util-test.js
2 files changed, 23 insertions(+), 14 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 6856795..52ba34b 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -159,6 +159,23 @@
 };
 };
 
+/**
+ * Get the page summary type.
+ * @param {!Object} meta page metadata from MW API
+ * return {!String} the summary type (one of 'standard', 'disambiguation', or 
'mainpage')
+ */
+mUtil.getSummaryType = function(meta) {
+const isDisambiguationPage = meta.pageprops
+  && {}.hasOwnProperty.call(meta.pageprops, 'disambiguation');
+if (meta.mainpage) {
+return 'mainpage';
+}
+if (isDisambiguationPage) {
+return 'disambiguation';
+}
+return 'standard';
+};
+
 /*
  * Build a page summary
  * @param {!String} domain the request domain
@@ -169,22 +186,9 @@
 mUtil.buildSummary = function(domain, title, pageData) {
 const page = pageData.page;
 const meta = pageData.meta;
-const pageProps = meta && meta.pageprops;
-const isDisambiguationPage = pageProps && 
{}.hasOwnProperty.call(pageProps, 'disambiguation');
-const isMainPage = meta.mainpage;
 const isContentModelWikitext = meta.contentmodel === 'wikitext';
 const isWhiteListedNamespace = 
mUtil.SUMMARY_NS_WHITELIST.includes(meta.ns);
 const isRedirect = meta.redirect;
-
-function getType() {
-if (isMainPage) {
-return 'mainpage';
-}
-if (isDisambiguationPage) {
-return 'disambiguation';
-}
-return 'standard';
-}
 
 if (!isContentModelWikitext) {
 return { code: 204 };
@@ -204,7 +208,7 @@
 
 return Object.assign({
 code: 200,
-type : getType(),
+type : mUtil.getSummaryType(meta),
 title: meta.normalizedtitle,
 displaytitle: meta.displaytitle,
 namespace: { id: meta.ns, text: meta.nsText },
diff --git a/test/lib/mobile-util/mobile-util-test.js 
b/test/lib/mobile-util/mobile-util-test.js
index a063737..bbc000b 100644
--- a/test/lib/mobile-util/mobile-util-test.js
+++ b/test/lib/mobile-util/mobile-util-test.js
@@ -30,4 +30,9 @@
 assert.deepEqual(mUtil.extractDbTitleFromAnchor(link), 'My_db_title');
 });
 
+it('getSummaryType identifies main and disambig pages, defaults to 
\'standard\'', () => {
+assert.deepEqual(mUtil.getSummaryType({"mainpage":true}), 'mainpage');
+
assert.deepEqual(mUtil.getSummaryType({"pageprops":{"disambiguation":""}}), 
'disambiguation');
+assert.deepEqual(mUtil.getSummaryType({}), 'standard');
+});
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd73ce5363719769d921957d8358c68fecf493e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Escape text node content in extractLeadIntroduction.js

2018-01-10 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403538 )

Change subject: Escape text node content in extractLeadIntroduction.js
..

Escape text node content in extractLeadIntroduction.js

Bug: T184558
Change-Id: I27ece6ae485520a631aaba9f6f34c40e9bf3e5f4
---
M lib/transformations/extractLeadIntroduction.js
M test/lib/transformations/extractLeadIntroduction.js
2 files changed, 26 insertions(+), 1 deletion(-)


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

diff --git a/lib/transformations/extractLeadIntroduction.js 
b/lib/transformations/extractLeadIntroduction.js
index 0b4e934..f586951 100644
--- a/lib/transformations/extractLeadIntroduction.js
+++ b/lib/transformations/extractLeadIntroduction.js
@@ -12,6 +12,24 @@
 }
 
 /*
+ * HTML escape a string.
+ * @param {!String} s
+ * @return {!String}
+ */
+function escape(s) {
+return s.replace(/[&<>"']/g, (c) => {
+switch (c) {
+case '&': return '';
+case '<': return '';
+case '>': return '';
+case '"': return '';
+default: return;
+}
+});
+}
+
+
+/*
  * Extracts the first non-empty paragraph from an article and any
  * nodes that follow it that are not themselves paragraphs.
  * @param {!Document} doc representing article
@@ -38,7 +56,7 @@
 // Deal with text nodes
 if (nextSibling.nodeType === NodeType.TEXT_NODE) {
 if (!isEmpty(nextSibling)) {
-p += nextSibling.textContent;
+p += escape(nextSibling.textContent);
 }
 } else {
 p += nextSibling.outerHTML;
diff --git a/test/lib/transformations/extractLeadIntroduction.js 
b/test/lib/transformations/extractLeadIntroduction.js
index 2118354..231ed9b 100644
--- a/test/lib/transformations/extractLeadIntroduction.js
+++ b/test/lib/transformations/extractLeadIntroduction.js
@@ -46,4 +46,11 @@
 assert.equal(lead, test[1]);
 });
 });
+
+it('Trailing text content is escaped', () => {
+const html = 'fooscriptalert(1);/script';
+const doc = domino.createDocument(html);
+const lead = extractLeadIntroduction(doc);
+assert.deepEqual(lead, html);
+});
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I27ece6ae485520a631aaba9f6f34c40e9bf3e5f4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix diff tests

2018-01-10 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403537 )

Change subject: Fix diff tests
..

Fix diff tests

Change-Id: Ibdee81784add939f1179b5ee08a1868f8801b882
---
M 
test/diff/results/page_formatted-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
M 
test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index fbf..35f0b31 100644
--- 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -75,7 +75,7 @@
   },
   {
 "id": 8,
-"text": "\n\n\n\nMultiple images:\nCautionEjectionTwo cards 
used by football referees\n\nImagemap:\n\nhttp://projects.vassar.edu/1896/democrats.html\; 
class=\"plainlinks\" rel=\"nofollow\" title=\"1896 Democrats\">\n\n\n\n\n\n\nPanoramas:\n\nHelsinki has many 
buildings.\n\n\n",
+"text": "\n\n\n\nMultiple images:\nCautionEjectionTwo cards 
used by football referees\n\nImagemap:\n\nhttp://projects.vassar.edu/1896/democrats.html\; 
class=\"plainlinks\" rel=\"nofollow\" title=\"1896 Democrats\">\n\n\n\n\n\n\nPanoramas:\n\nHelsinki has many 
buildings.\n\n\n",
 "toclevel": 1,
 "line": "Images",
 "anchor": "Images"
diff --git 
"a/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index f484eb6..c01ada5 100644
--- 
"a/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -229,7 +229,7 @@
   },
   {
 "id": 8,
-"text": "\n\n\n\nMultiple images:\nCautionEjectionTwo cards 
used by football referees\n\nImagemap:\n\nhttp://projects.vassar.edu/1896/democrats.html\; 
class=\"plainlinks\" rel=\"nofollow\" title=\"1896 Democrats\">\n\n\n\n\n\n\nPanoramas:\n\nHelsinki has many 
buildings.\n\n\n",
+"text": "\n\n\n\nMultiple images:\nCautionEjectionTwo cards 
used by football referees\n\nImagemap:\n\nhttp://projects.vassar.edu/1896/democrats.html\; 
class=\"plainlinks\" rel=\"nofollow\" title=\"1896 Democrats\">\n\n\n\n\n\n\nPanoramas:\n\nHelsinki has many 
buildings.\n\n\n",
 "toclevel": 1,
 "line": "Images",
 "anchor": "Images"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibdee81784add939f1179b5ee08a1868f8801b882
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix misleading testing utilities and update tests

2018-01-09 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403324 )

Change subject: Fix misleading testing utilities and update tests
..

Fix misleading testing utilities and update tests

The deepEqual and isDeepEqual wrapper methods in test/util/assert.js
confusingly use RegExp matching for string inputs in a way that is not
at all equivalent to === and makes it very easy to write tests resulting
in false positives (see
https://github.com/wikimedia/service-template-node/issues/94, for
example).

This eliminates the alternate string behavior and updates the tests that
are broken by that change.

This should be upstreamed in some form.

Change-Id: Ia9b01b26ac004294e10901736ed3d8e8653be984
---
M test/features/app/app.js
M test/utils/assert.js
M test/utils/headers.js
3 files changed, 7 insertions(+), 15 deletions(-)


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

diff --git a/test/features/app/app.js b/test/features/app/app.js
index 3bd5758..2035558 100644
--- a/test/features/app/app.js
+++ b/test/features/app/app.js
@@ -52,9 +52,9 @@
 assert.deepEqual(res.headers['x-xss-protection'], '1; mode=block');
 assert.deepEqual(res.headers['x-content-type-options'], 'nosniff');
 assert.deepEqual(res.headers['x-frame-options'], 'SAMEORIGIN');
-assert.deepEqual(res.headers['content-security-policy'], 
'default-src');
-assert.deepEqual(res.headers['x-content-security-policy'], 
'default-src');
-assert.deepEqual(res.headers['x-webkit-csp'], 'default-src');
+assert.contains(res.headers['content-security-policy'], 
'default-src');
+assert.contains(res.headers['x-content-security-policy'], 
'default-src');
+assert.contains(res.headers['x-webkit-csp'], 'default-src');
 });
 });
 
diff --git a/test/utils/assert.js b/test/utils/assert.js
index fcdd736..f20d959 100644
--- a/test/utils/assert.js
+++ b/test/utils/assert.js
@@ -9,11 +9,7 @@
 function deepEqual(result, expected, message) {
 
 try {
-if (typeof expected === 'string') {
-assert.ok(result === expected || (new 
RegExp(expected).test(result)));
-} else {
-assert.deepEqual(result, expected, message);
-}
+assert.deepEqual(result, expected, message);
 } catch (e) {
 console.log(`Expected:\n${JSON.stringify(expected, null, 2)}`);
 console.log(`Result:\n${JSON.stringify(result, null, 2)}`);
@@ -40,7 +36,7 @@
 function contentType(res, expected) {
 
 const actual = res.headers['content-type'];
-deepEqual(actual, expected,
+assert.ok(RegExp(expected).test(actual),
 `Expected content-type to be ${expected}, but was ${actual}`);
 
 }
@@ -49,11 +45,7 @@
 function isDeepEqual(result, expected, message) {
 
 try {
-if (typeof expected === 'string') {
-assert.ok(result === expected || (new 
RegExp(expected).test(result)), message);
-} else {
-assert.deepEqual(result, expected, message);
-}
+assert.deepEqual(result, expected, message);
 return true;
 } catch (e) {
 return false;
diff --git a/test/utils/headers.js b/test/utils/headers.js
index 0447ba3..73c01f5 100644
--- a/test/utils/headers.js
+++ b/test/utils/headers.js
@@ -14,7 +14,7 @@
 assert.deepEqual(res.status, 200);
 expContentType = expContentType || JSON_CONTENT_TYPE_REGEX;
 assert.contentType(res, expContentType);
-assert.deepEqual(res.headers.etag, '^"[^/"]+/[^/"]+"$',
+assert.ok(RegExp('^"[^/"]+/[^/"]+"$').test(res.headers.etag),
 'The ETag header is not present or invalid');
 assert.deepEqual(res.headers.etag.indexOf('undefined'), -1,
 'etag should not contain "undefined"');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9b01b26ac004294e10901736ed3d8e8653be984
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Remove unwanted attributes for elements

2018-01-09 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403149 )

Change subject: Remove unwanted attributes for  elements
..

Remove unwanted attributes for  elements

In preparation for reference links to be wrapped in , not 
(I7c83d12d).

Change-Id: I6804f294c480e3548c1b3afa9ecfa240d814e0ed
---
M lib/transforms.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/lib/transforms.js b/lib/transforms.js
index 727ab3a..4a98b7c 100644
--- a/lib/transforms.js
+++ b/lib/transforms.js
@@ -216,6 +216,7 @@
 'resource']);
 _rmAttributes(doc, 'figure-inline', figureInlineAttributes);
 _rmAttributes(doc, 'span', figureInlineAttributes);
+_rmAttributes(doc, 'sup', ['about', 'rel', 'typeof', 'data-mw']);
 
 _rmMwIdAttributes(doc, 'a[href]');
 _rmMwIdAttributes(doc, 'b');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6804f294c480e3548c1b3afa9ecfa240d814e0ed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Stop getting dc:lastmodified"

2018-01-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402837 )

Change subject: Revert "Stop getting dc:lastmodified"
..

Revert "Stop getting dc:lastmodified"

Needed for making the summary 'timestamp' field refer to the correct
revision.

This reverts commit bf67c970253ca701fde856330e0347581cd57063.

Bug: T184429
Change-Id: Ibbc20436c0a0cb6d5301c54ba399024d73a53a77
---
M lib/parsoid-access.js
1 file changed, 10 insertions(+), 0 deletions(-)


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

diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index 3ae3308..8633db3 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -72,6 +72,15 @@
 }
 
 /**
+ * 
+ * @param {!document} doc
+ */
+function getModified(doc) {
+return doc.querySelector('head > 
meta[property="dc:modified"]').getAttribute('content')
+.replace(/\.000Z$/, 'Z');
+}
+
+/**
  * Gets the base URI from a Parsoid document
  * 
  * @param {!document} doc
@@ -109,6 +118,7 @@
 const doc = domino.createDocument(response.body);
 
 // Note: these properties must be obtained before stripping markup
+page.lastmodified = getModified(doc);
 parseProperty.parsePronunciation(doc, page);
 parseProperty.parseSpokenWikipedia(doc, page);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbc20436c0a0cb6d5301c54ba399024d73a53a77
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Summary: Make timestamp refer to the requested revision

2018-01-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402838 )

Change subject: Summary: Make timestamp refer to the requested revision
..

Summary: Make timestamp refer to the requested revision

Bug: T184429
Change-Id: I38da647184a71e3b51ff940e6435d202ea7d356b
---
M lib/mobile-util.js
M test/features/summary/pagecontent.js
2 files changed, 11 insertions(+), 1 deletion(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 95f20b7..cc06249 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -233,7 +233,7 @@
 dir: meta.dir,
 revision: page.revision,
 tid: page.tid,
-timestamp: meta.lastmodified,
+timestamp: page.lastmodified,
 description: meta.description,
 coordinates: meta.geo && {
 lat: meta.geo.latitude,
diff --git a/test/features/summary/pagecontent.js 
b/test/features/summary/pagecontent.js
index 82a6cd8..17c50af 100644
--- a/test/features/summary/pagecontent.js
+++ b/test/features/summary/pagecontent.js
@@ -65,4 +65,14 @@
 assert.ok(!res.body);
 });
 });
+
+it('timestamp should refer to the requested revision, not the latest 
revision', () => {
+const uri = localUri('John_Candy/813020982');
+return preq.get({ uri })
+.then((res) => {
+assert.deepEqual(res.status, 200);
+assert.deepEqual(res.body.type, 'standard');
+assert.deepEqual(res.body.timestamp, '2017-12-01T07:29:24Z');
+});
+});
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38da647184a71e3b51ff940e6435d202ea7d356b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Summary: return type=mainpage for project main pages

2018-01-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402835 )

Change subject: Summary: return type=mainpage for project main pages
..

Summary: return type=mainpage for project main pages

Bug: T184430
Change-Id: Ied1fa460faece896ef2f68a748767283a514d4d7
---
M lib/mobile-util.js
M test/features/summary/pagecontent.js
2 files changed, 17 insertions(+), 5 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 95f20b7..1e545fb 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -193,15 +193,27 @@
  * @param {!String} domain the request domain
  * @param {!Object} title a mediawiki-title object for the page title
  * @param {!Object} pageData raw page data for the page
- * @param {?boolean} disambiguation whether the page is a disambiguation page
  * @return {!Object} a summary 2.0 spec-compliant page summary object
  */
-mUtil.buildSummary = function(domain, title, pageData, disambiguation = false) 
{
+mUtil.buildSummary = function(domain, title, pageData) {
 const page = pageData.page;
 const meta = pageData.meta;
+const pageProps = meta && meta.pageprops;
+const isDisambiguationPage = pageProps && 
{}.hasOwnProperty.call(pageProps, 'disambiguation');
+const isMainPage = meta.mainpage;
 const isContentModelWikitext = meta.contentmodel === 'wikitext';
 const isWhiteListedNamespace = 
mUtil.SUMMARY_NS_WHITELIST.includes(meta.ns);
 const isRedirect = meta.redirect;
+
+function getType() {
+if (isMainPage) {
+return 'mainpage';
+}
+if (isDisambiguationPage) {
+return 'disambiguation';
+}
+return 'standard';
+}
 
 if (!isContentModelWikitext) {
 return { code: 204 };
@@ -221,7 +233,7 @@
 
 return Object.assign({
 code: 200,
-type : disambiguation ? 'disambiguation' : 'standard',
+type : getType(),
 title: meta.normalizedtitle,
 displaytitle: meta.displaytitle,
 namespace: { id: meta.ns, text: meta.nsText },
diff --git a/test/features/summary/pagecontent.js 
b/test/features/summary/pagecontent.js
index 82a6cd8..6dc28e3 100644
--- a/test/features/summary/pagecontent.js
+++ b/test/features/summary/pagecontent.js
@@ -46,12 +46,12 @@
 });
 });
 
-it('empty summary (not 204) should be sent for project main page', () => {
+it('main page should return empty summary (not 204) and type should be 
\'mainpage\'', () => {
 const uri = localUri('Main_Page');
 return preq.get({ uri })
 .then((res) => {
 assert.deepEqual(res.status, 200);
-assert.deepEqual(res.body.type, 'standard');
+assert.deepEqual(res.body.type, 'mainpage', 'type should be 
\'mainpage\'');
 assert.deepEqual(res.body.extract, '', 'should send empty 
plaintext extract');
 assert.deepEqual(res.body.extract_html, '', 'should send empty 
html extract');
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied1fa460faece896ef2f68a748767283a514d4d7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Update diff results to fix tests

2018-01-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402830 )

Change subject: Hygiene: Update diff results to fix tests
..

Hygiene: Update diff results to fix tests

Change-Id: I2bc9258e6c042d546fa757468d2b0be9fe19f211
---
M 
test/diff/results/page_formatted-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
M test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
M 
test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
3 files changed, 5 insertions(+), 5 deletions(-)


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

diff --git 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index 22561c4..fbf 100644
--- 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -54,7 +54,7 @@
   },
   {
 "id": 5,
-"text": "\n( e16) | g8-.( a-.) b8.-> c16 g8( e) c-.( d-.) | 
ees4->< ees8--( b'--) ees,4-- ees8--( b'--)! | ees,4->mf( bes) } 
}}\">\n\n\n\n",
+"text": "\n\n\n\n\n\n",
 "toclevel": 1,
 "line": "Musical notation",
 "anchor": "Musical_notation"
diff --git a/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json 
b/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
index d973861..40d55f5 100644
--- a/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
+++ b/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
@@ -1080,13 +1080,13 @@
   "thumbnail": {
 "source": 
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/II._R%C3%A1k%C3%B3czi_Ferenc_M%C3%A1nyoki.jpg/320px-II._R%C3%A1k%C3%B3czi_Ferenc_M%C3%A1nyoki.jpg;,
 "width": 320,
-"height": 377,
+"height": 395,
 "mime": "image/jpeg"
   },
   "original": {
 "source": 
"https://upload.wikimedia.org/wikipedia/commons/6/61/II._R%C3%A1k%C3%B3czi_Ferenc_M%C3%A1nyoki.jpg;,
-"width": 2388,
-"height": 2812,
+"width": 971,
+"height": 1200,
 "mime": "image/jpeg"
   },
   "file_page": 
"https://commons.wikimedia.org/wiki/File:II._Rákóczi_Ferenc_Mányoki.jpg;,
diff --git 
"a/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index 379ae25..f484eb6 100644
--- 
"a/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -208,7 +208,7 @@
   },
   {
 "id": 5,
-"text": "\n( e16) | g8-.( a-.) b8.-> c16 g8( e) c-.( d-.) | 
ees4->< ees8--( b'--) ees,4-- ees8--( b'--)! | ees,4->mf( bes) } 
}}\">\n\n\n\n",
+"text": "\n\n\n\n\n\n",
 "toclevel": 1,
 "line": "Musical notation",
 "anchor": "Musical_notation"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bc9258e6c042d546fa757468d2b0be9fe19f211
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Move test request from enwiki beta to testwiki

2018-01-05 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402449 )

Change subject: Hygiene: Move test request from enwiki beta to testwiki
..

Hygiene: Move test request from enwiki beta to testwiki

We should only test against the Beta Cluster when we specifically mean
to test the beta cluster. This also makes it easier to test Parsoid
locally.

Change-Id: I37b90a5d77606fba1426ebb5b2456112b2efbe52
---
M test/features/summary/pagecontent.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/test/features/summary/pagecontent.js 
b/test/features/summary/pagecontent.js
index 82a6cd8..69d5d2e 100644
--- a/test/features/summary/pagecontent.js
+++ b/test/features/summary/pagecontent.js
@@ -36,7 +36,7 @@
 });
 
 it('empty summary (not 204) should be sent for empty page', () => {
-const uri = localUri('PreviewsEmpty%2Fsandbox', 
'en.wikipedia.beta.wmflabs.org');
+const uri = localUri('Empty', 'test.wikipedia.org');
 return preq.get({ uri })
 .then((res) => {
 assert.deepEqual(res.status, 200);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37b90a5d77606fba1426ebb5b2456112b2efbe52
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Update tests to allow for testing arbitrary RESTBase install...

2018-01-05 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402416 )

Change subject: Update tests to allow for testing arbitrary RESTBase 
installations
..

Update tests to allow for testing arbitrary RESTBase installations

Updates a couple of tests so that they don't test for WMF production
REST API URLs.  Useful for testing a local RESTBase.

Change-Id: I89139a1115475dfb16870e84745e93796c3bc31b
---
M config.dev.yaml
M test/features/featured/pagecontent.js
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/config.dev.yaml b/config.dev.yaml
index 3b0d891..1b9f9bf 100644
--- a/config.dev.yaml
+++ b/config.dev.yaml
@@ -71,7 +71,7 @@
   # the template used for contacting RESTBase
   restbase_req:
 method: '{{request.method}}'
-uri: https://{{domain}}/api/rest_v1/{+path}
+uri: http://localhost:7231/{{domain}}/v1/{+path}
 query: '{{ default(request.query, {}) }}'
 headers: '{{request.headers}}'
 body: '{{request.body}}'
diff --git a/test/features/featured/pagecontent.js 
b/test/features/featured/pagecontent.js
index 2c342c2..17c3fc7 100644
--- a/test/features/featured/pagecontent.js
+++ b/test/features/featured/pagecontent.js
@@ -30,7 +30,7 @@
 return preq.get({ uri: 
`${server.config.uri}en.wikipedia.org/v1/page/featured/2016/04/15` })
 .then((res) => {
 assert.status(res, 200);
-assert.equal(res.body.$merge, 
'https://en.wikipedia.org/api/rest_v1/page/summary/Cosmic_Stories_and_Stirring_Science_Stories');
+assert.contains(res.body.$merge[0], 
'v1/page/summary/Cosmic_Stories_and_Stirring_Science_Stories');
 });
 });
 
@@ -38,7 +38,7 @@
 return preq.get({ uri: 
`${server.config.uri}en.wikipedia.org/v1/page/featured/2016/04/29` })
 .then((res) => {
 assert.status(res, 200);
-assert.equal(res.body.$merge, 
'https://en.wikipedia.org/api/rest_v1/page/summary/Lightning_(Final_Fantasy)');
+assert.contains(res.body.$merge[0], 
'v1/page/summary/Lightning_(Final_Fantasy)');
 });
 });
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89139a1115475dfb16870e84745e93796c3bc31b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Update read-html tests to use new 'section' selector

2018-01-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402149 )

Change subject: Update read-html tests to use new 'section' selector
..

Update read-html tests to use new 'section' selector

Change-Id: I1213ee9bf4f7decaaf5b006ef02d6edf33a1b619
---
M test/features/read-html/pagecontent-base.js
M test/features/read-html/pagecontent.js
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/test/features/read-html/pagecontent-base.js 
b/test/features/read-html/pagecontent-base.js
index 8cda184..db3ed72 100644
--- a/test/features/read-html/pagecontent-base.js
+++ b/test/features/read-html/pagecontent-base.js
@@ -26,7 +26,7 @@
 return preq.get({ uri })
 .then((res) => {
 const document = domino.createDocument(res.body);
-assert.selectorExistsNTimes(document, 'div.toclevel_1', 7, 'should 
have 7 sections');
+assert.selectorExistsNTimes(document, 'section', 7, 'should have 7 
sections');
 });
 });
 });
diff --git a/test/features/read-html/pagecontent.js 
b/test/features/read-html/pagecontent.js
index a52535a..c6f7784 100644
--- a/test/features/read-html/pagecontent.js
+++ b/test/features/read-html/pagecontent.js
@@ -26,7 +26,7 @@
 return preq.get({ uri })
 .then((res) => {
 const document = domino.createDocument(res.body);
-assert.selectorExistsNTimes(document, 'div.toclevel_1', 7, 'should 
have 7 sections');
+assert.selectorExistsNTimes(document, 'section', 7, 'should have 7 
sections');
 });
 });
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1213ee9bf4f7decaaf5b006ef02d6edf33a1b619
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Skip some tests because of upstream issues"

2018-01-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402150 )

Change subject: Revert "Skip some tests because of upstream issues"
..

Revert "Skip some tests because of upstream issues"

This reverts commit ca283c70ed81dc3496c70571f481e7c7ef2b90ea.

Change-Id: Ie6cfc2499245c24d844bd0397f69380a31c795ce
---
M test/features/mobile-sections/shared.js
M test/features/read-html/pagecontent-base.js
M test/features/read-html/pagecontent.js
3 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/test/features/mobile-sections/shared.js 
b/test/features/mobile-sections/shared.js
index c277306..59dfc83 100644
--- a/test/features/mobile-sections/shared.js
+++ b/test/features/mobile-sections/shared.js
@@ -69,7 +69,7 @@
 });
 });
 
-it.skip('Check content of fresh revision', () => { // skipped because of 
issue T182770 (RB?)
+it('Check content of fresh revision', () => {
 const title = 'Leonard_Cohen';
 const uri = localUri(title);
 return preq.get({ uri })
diff --git a/test/features/read-html/pagecontent-base.js 
b/test/features/read-html/pagecontent-base.js
index db3ed72..22b17a1 100644
--- a/test/features/read-html/pagecontent-base.js
+++ b/test/features/read-html/pagecontent-base.js
@@ -21,7 +21,7 @@
 return headers.checkHeaders(uri, headers.HTML_CONTENT_TYPE_REGEX);
 });
 
-it.skip('HTML should be sectioned', () => { // skipped because of issue 
T182770 (RB?)
+it('HTML should be sectioned', () => {
 const uri = localUri('Foobar/788941783');
 return preq.get({ uri })
 .then((res) => {
diff --git a/test/features/read-html/pagecontent.js 
b/test/features/read-html/pagecontent.js
index c6f7784..2451540 100644
--- a/test/features/read-html/pagecontent.js
+++ b/test/features/read-html/pagecontent.js
@@ -21,7 +21,7 @@
 return headers.checkHeaders(uri, headers.HTML_CONTENT_TYPE_REGEX);
 });
 
-it.skip('HTML should be sectioned', () => { // skipped because of issue 
T182770 (RB?)
+it('HTML should be sectioned', () => {
 const uri = localUri('Foobar/788941783');
 return preq.get({ uri })
 .then((res) => {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6cfc2499245c24d844bd0397f69380a31c795ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Include H1 tags when evaluating sections

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398182 )

Change subject: Include H1 tags when evaluating sections
..

Include H1 tags when evaluating sections

After excluding sections with -1 and -2 IDs from warnings, all of the
remaining cases I've seen involve sections with H1 headers, which we've
been excluding.  These are rare in the main namespace (with at least one
exception [1]) but rather common in other namespaces.[2]

This expands the logic to include H1 as well.

[1] https://ru.wikipedia.org/api/rest_v1/page/html/Kawasaki_Ki-61_Hien

[2]
https://en.wikipedia.org/api/rest_v1/page/html/Draft:West_Virginia_High_School_Football_State_Championships
https://en.wikipedia.org/api/rest_v1/page/html/User:Sarahj2107/Dashboard
https://en.wikipedia.org/api/rest_v1/page/html/User:Vicenarian/State_of_the_Wiki

Bug: T182774
Change-Id: I871225870eec478f4e6281b35b9d432a7f63b63e
---
M lib/parsoidSectionsUsingSectionTags.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/lib/parsoidSectionsUsingSectionTags.js 
b/lib/parsoidSectionsUsingSectionTags.js
index 6fb3b72..c25b7e4 100644
--- a/lib/parsoidSectionsUsingSectionTags.js
+++ b/lib/parsoidSectionsUsingSectionTags.js
@@ -79,7 +79,7 @@
 allSections.push(sectionObj);
 state.pauseDescent = false;
 } else if (sectionObj && !sectionObj.anchor // heading info not yet filled 
out
-&& /^H[2-6]$/.test(node.tagName) // we're at a heading tag
+&& /^H[1-6]$/.test(node.tagName) // we're at a heading tag
 && node.parentNode.tagName === 'SECTION') { // direct descendant 
of a section
 sectionObj.toclevel = parseInt(node.tagName.charAt(1), 10) - 1;
 sectionObj.line = node.innerHTML.trim();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I871225870eec478f4e6281b35b9d432a7f63b63e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Update section validation logic, take 2

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398181 )

Change subject: Update section validation logic, take 2
..

Update section validation logic, take 2

Updated to use the bunyan Logger class correctly! ;)

1) Log warnings rather than throwing errors, and
2) Only for sections with IDs >= 0 (i.e., not non-editable or pseudo-
   sections).

Bug: T182774
Change-Id: I2b037f5c98edf8c964548c011973924aa6ae14cb
---
M lib/parsoid-access.js
M lib/parsoidSections.js
M lib/parsoidSectionsUsingSectionTags.js
M test/lib/parsoid/parsoid-sections-section-elements-tests.js
4 files changed, 57 insertions(+), 31 deletions(-)


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

diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index 338ce33..3ae3308 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -119,7 +119,7 @@
 transforms.stripUnneededMarkup(doc, legacy);
 parsoidSections.addSectionDivs(doc);
 
-page.sections = parsoidSections.getSectionsText(doc);
+page.sections = parsoidSections.getSectionsText(doc, req.logger);
 return page;
 });
 }
diff --git a/lib/parsoidSections.js b/lib/parsoidSections.js
index dcdbb72..f8e21d6 100644
--- a/lib/parsoidSections.js
+++ b/lib/parsoidSections.js
@@ -27,13 +27,14 @@
  * Gets the sections array, including HTML string and metadata for all sections
  * (id, anchor, line, toclevel).
  * @param {!document} doc the parsed DOM Document of the Parsoid output
+ * @param {!Logger} logger the app's bunyan logger
  * @return {!sections[]} an array of section JSON elements
  */
-function getSectionsText(doc) {
+function getSectionsText(doc, logger) {
 if (!hasParsoidSections(doc)) {
 return parsoidSectionsUsingDivs.getSectionsText(doc);
 } else {
-return parsoidSectionsUsingSectionTags.getSectionsText(doc);
+return parsoidSectionsUsingSectionTags.getSectionsText(doc, logger);
 }
 }
 
diff --git a/lib/parsoidSectionsUsingSectionTags.js 
b/lib/parsoidSectionsUsingSectionTags.js
index 76e471d..6fb3b72 100644
--- a/lib/parsoidSectionsUsingSectionTags.js
+++ b/lib/parsoidSectionsUsingSectionTags.js
@@ -1,8 +1,6 @@
 'use strict';
 
 const parsoidDomUtils = require('parsoid-dom-utils');
-// const sUtil = require('./util');
-// const HTTPError = sUtil.HTTPError;
 const NodeType = require('./nodeType');
 
 /**
@@ -39,7 +37,13 @@
 }
 }
 
-/* function throwIfPreviousSectionIsIncomplete(allSections, sectionObj) {
+// skip lead sections since they don't have headings;
+// no line and no anchor means incomplete section
+function shouldLogInvalidSectionWarning(sectionObj) {
+return sectionObj.id >= 1 && !sectionObj.line && !sectionObj.anchor;
+}
+
+function validatePreviousSection(logger, allSections, sectionObj) {
 if (allSections.length === 0) {
 return;
 }
@@ -47,30 +51,29 @@
 if (!sectionObj) {
 sectionObj = allSections[allSections.length - 1];
 }
-// skip lead sections since they don't have headings;
-// no line and no anchor means incomplete section
-if (allSections.length > 1 && !sectionObj.line && !sectionObj.anchor) {
-throw new HTTPError({
-status: 502,
-type: 'unsupported_section',
-title: 'Section structure not supported',
+
+if (shouldLogInvalidSectionWarning(sectionObj)) {
+logger.log('warn', {
+warning: 'invalid_section',
+title: 'Found section without expected heading',
 detail: `Cannot find heading for section number ${sectionObj.id}.`
 });
 }
-} */
+}
 
 /**
  * Visits one DOM node. Do the stuff that needs to be done when a single DOM 
node is handled.
  * In this case, starts a new section object when a  tag is 
encountered that is a
  * direct descendant
+ * @param {!Logger} logger the app's bunyan logger
  * @param {!DOMNode} node the node to visit
  * @param {!Object[]} allSections the array containing the results
  * @param {!Object} state some state to pass around
  */
-function visit(node, allSections, state) {
+function visit(logger, node, allSections, state) {
 let sectionObj = allSections.length > 0 ? allSections[allSections.length - 
1] : undefined;
 if (node.tagName === 'SECTION') {
-// throwIfPreviousSectionIsIncomplete(allSections, sectionObj);
+validatePreviousSection(logger, allSections, sectionObj);
 
 sectionObj = { id: getSectionNumber(node), text: '' };
 allSections.push(sectionObj);
@@ -99,16 +102,17 @@
  * This started out with a traditional iterative DFS algorithm but added a 
boolean to stop
  * descending so we don't duplicate content since elsewhere outerHTML is used 
(which contains
  * content of sub-nodes).
+ * @param {!Logger} logger the app's bunyan logger
  * @param {!DOMElement} 

[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to ddddebb

2017-12-13 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/398137 )

Change subject: Update mobileapps to ebb
..


Update mobileapps to ebb

List of changes:
ebb Revert "Update section validation logic"
xxx Update node module dependencies

Change-Id: I329e1dff15f292808fffe25fb8e6db82b13364d9
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Mholloway: Verified; Looks good to me, approved



diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 9652936..addd045 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "e42470adf4cfc56fb00c7247c83db58bc9f1f2f5",
+  "_shasum": "2e09b771675fb9e5c4217ed5bdace8a8037cd064",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 556514d..45cb420 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "1d9bdaaab8aacc0dfb3ae106d1dfe829b0149c49",
+  "_shasum": "5e1c8e74520bc57bfa0f542d2b0fdd21fa83800e",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index bf67c97..ebb 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit bf67c970253ca701fde856330e0347581cd57063
+Subproject commit ebb87374b3c69ff6a3a71dffaf4e1e64af9b

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I329e1dff15f292808fffe25fb8e6db82b13364d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to ddddebb

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398137 )

Change subject: Update mobileapps to ebb
..

Update mobileapps to ebb

List of changes:
ebb Revert "Update section validation logic"
xxx Update node module dependencies

Change-Id: I329e1dff15f292808fffe25fb8e6db82b13364d9
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/37/398137/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 9652936..addd045 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "e42470adf4cfc56fb00c7247c83db58bc9f1f2f5",
+  "_shasum": "2e09b771675fb9e5c4217ed5bdace8a8037cd064",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 556514d..45cb420 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "1d9bdaaab8aacc0dfb3ae106d1dfe829b0149c49",
+  "_shasum": "5e1c8e74520bc57bfa0f542d2b0fdd21fa83800e",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index bf67c97..ebb 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit bf67c970253ca701fde856330e0347581cd57063
+Subproject commit ebb87374b3c69ff6a3a71dffaf4e1e64af9b

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I329e1dff15f292808fffe25fb8e6db82b13364d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Update section validation logic"

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398135 )

Change subject: Revert "Update section validation logic"
..

Revert "Update section validation logic"

This reverts commit 6181d6a191dce0ca581475abd373d23348141748.

Change-Id: Ib65e2d670263f37b34257928f9b94f8884e6e64b
---
M lib/parsoid-access.js
M lib/parsoidSections.js
M lib/parsoidSectionsUsingSectionTags.js
M test/lib/parsoid/parsoid-sections-section-elements-tests.js
4 files changed, 31 insertions(+), 57 deletions(-)


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

diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index 3ae3308..338ce33 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -119,7 +119,7 @@
 transforms.stripUnneededMarkup(doc, legacy);
 parsoidSections.addSectionDivs(doc);
 
-page.sections = parsoidSections.getSectionsText(doc, req.logger);
+page.sections = parsoidSections.getSectionsText(doc);
 return page;
 });
 }
diff --git a/lib/parsoidSections.js b/lib/parsoidSections.js
index f8e21d6..dcdbb72 100644
--- a/lib/parsoidSections.js
+++ b/lib/parsoidSections.js
@@ -27,14 +27,13 @@
  * Gets the sections array, including HTML string and metadata for all sections
  * (id, anchor, line, toclevel).
  * @param {!document} doc the parsed DOM Document of the Parsoid output
- * @param {!Logger} logger the app's bunyan logger
  * @return {!sections[]} an array of section JSON elements
  */
-function getSectionsText(doc, logger) {
+function getSectionsText(doc) {
 if (!hasParsoidSections(doc)) {
 return parsoidSectionsUsingDivs.getSectionsText(doc);
 } else {
-return parsoidSectionsUsingSectionTags.getSectionsText(doc, logger);
+return parsoidSectionsUsingSectionTags.getSectionsText(doc);
 }
 }
 
diff --git a/lib/parsoidSectionsUsingSectionTags.js 
b/lib/parsoidSectionsUsingSectionTags.js
index ce27178..76e471d 100644
--- a/lib/parsoidSectionsUsingSectionTags.js
+++ b/lib/parsoidSectionsUsingSectionTags.js
@@ -1,6 +1,8 @@
 'use strict';
 
 const parsoidDomUtils = require('parsoid-dom-utils');
+// const sUtil = require('./util');
+// const HTTPError = sUtil.HTTPError;
 const NodeType = require('./nodeType');
 
 /**
@@ -37,13 +39,7 @@
 }
 }
 
-// skip lead sections since they don't have headings;
-// no line and no anchor means incomplete section
-function shouldLogInvalidSectionWarning(sectionObj) {
-return sectionObj.id >= 1 && !sectionObj.line && !sectionObj.anchor;
-}
-
-function validatePreviousSection(logger, allSections, sectionObj) {
+/* function throwIfPreviousSectionIsIncomplete(allSections, sectionObj) {
 if (allSections.length === 0) {
 return;
 }
@@ -51,29 +47,30 @@
 if (!sectionObj) {
 sectionObj = allSections[allSections.length - 1];
 }
-
-if (shouldLogInvalidSectionWarning(sectionObj)) {
-logger.warn({
-warning: 'invalid_section',
-title: 'Found section without expected heading',
+// skip lead sections since they don't have headings;
+// no line and no anchor means incomplete section
+if (allSections.length > 1 && !sectionObj.line && !sectionObj.anchor) {
+throw new HTTPError({
+status: 502,
+type: 'unsupported_section',
+title: 'Section structure not supported',
 detail: `Cannot find heading for section number ${sectionObj.id}.`
 });
 }
-}
+} */
 
 /**
  * Visits one DOM node. Do the stuff that needs to be done when a single DOM 
node is handled.
  * In this case, starts a new section object when a  tag is 
encountered that is a
  * direct descendant
- * @param {!Logger} logger the app's bunyan logger
  * @param {!DOMNode} node the node to visit
  * @param {!Object[]} allSections the array containing the results
  * @param {!Object} state some state to pass around
  */
-function visit(logger, node, allSections, state) {
+function visit(node, allSections, state) {
 let sectionObj = allSections.length > 0 ? allSections[allSections.length - 
1] : undefined;
 if (node.tagName === 'SECTION') {
-validatePreviousSection(logger, allSections, sectionObj);
+// throwIfPreviousSectionIsIncomplete(allSections, sectionObj);
 
 sectionObj = { id: getSectionNumber(node), text: '' };
 allSections.push(sectionObj);
@@ -102,17 +99,16 @@
  * This started out with a traditional iterative DFS algorithm but added a 
boolean to stop
  * descending so we don't duplicate content since elsewhere outerHTML is used 
(which contains
  * content of sub-nodes).
- * @param {!Logger} logger the app's bunyan logger
  * @param {!DOMElement} rootElement the root of the DOM tree which needs to be 
traversed
  * @param {!Object[]} allSections holds the results
  */
-function traverseDF(logger, 

[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to bf67c97

2017-12-13 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/398125 )

Change subject: Update mobileapps to bf67c97
..


Update mobileapps to bf67c97

List of changes:
69530c5 Dev: Stop caching test HTTP responses by default
ca283c7 Skip some tests because of upstream issues
5b24b56 Adjust end time for fundraising announcements
6181d6a Update section validation logic
bf67c97 Stop getting dc:lastmodified
xxx Update node module dependencies

Change-Id: Iafedf7e8dd4b11e58c7e31582f54458a6e538cd4
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Mholloway: Verified; Looks good to me, approved



diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index bafd7e0..9652936 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "d3b44e3ead73d28f27742b4f4f679aaa13043278",
+  "_shasum": "e42470adf4cfc56fb00c7247c83db58bc9f1f2f5",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 63e4d3b..556514d 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "c9fc70b93cfdcce4bc17f48ef0a66cd1273f6613",
+  "_shasum": "1d9bdaaab8aacc0dfb3ae106d1dfe829b0149c49",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index bfc3588..bf67c97 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit bfc3588f79b368c8ecb812fc2c763f058c69d1ff
+Subproject commit bf67c970253ca701fde856330e0347581cd57063

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iafedf7e8dd4b11e58c7e31582f54458a6e538cd4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to bf67c97

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398125 )

Change subject: Update mobileapps to bf67c97
..

Update mobileapps to bf67c97

List of changes:
69530c5 Dev: Stop caching test HTTP responses by default
ca283c7 Skip some tests because of upstream issues
5b24b56 Adjust end time for fundraising announcements
6181d6a Update section validation logic
bf67c97 Stop getting dc:lastmodified
xxx Update node module dependencies

Change-Id: Iafedf7e8dd4b11e58c7e31582f54458a6e538cd4
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/25/398125/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index bafd7e0..9652936 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "d3b44e3ead73d28f27742b4f4f679aaa13043278",
+  "_shasum": "e42470adf4cfc56fb00c7247c83db58bc9f1f2f5",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 63e4d3b..556514d 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "c9fc70b93cfdcce4bc17f48ef0a66cd1273f6613",
+  "_shasum": "1d9bdaaab8aacc0dfb3ae106d1dfe829b0149c49",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index bfc3588..bf67c97 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit bfc3588f79b368c8ecb812fc2c763f058c69d1ff
+Subproject commit bf67c970253ca701fde856330e0347581cd57063

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafedf7e8dd4b11e58c7e31582f54458a6e538cd4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Stop getting dc:lastmodified

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398122 )

Change subject: Stop getting dc:lastmodified
..

Stop getting dc:lastmodified

Throwing errors in prod and we don't use it.

Change-Id: I2b39dbf5f32e89224fae34aa31410bc6e7b24781
---
M lib/parsoid-access.js
1 file changed, 0 insertions(+), 10 deletions(-)


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

diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index 8633db3..3ae3308 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -72,15 +72,6 @@
 }
 
 /**
- * 
- * @param {!document} doc
- */
-function getModified(doc) {
-return doc.querySelector('head > 
meta[property="dc:modified"]').getAttribute('content')
-.replace(/\.000Z$/, 'Z');
-}
-
-/**
  * Gets the base URI from a Parsoid document
  * 
  * @param {!document} doc
@@ -118,7 +109,6 @@
 const doc = domino.createDocument(response.body);
 
 // Note: these properties must be obtained before stripping markup
-page.lastmodified = getModified(doc);
 parseProperty.parsePronunciation(doc, page);
 parseProperty.parseSpokenWikipedia(doc, page);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b39dbf5f32e89224fae34aa31410bc6e7b24781
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Update section validation logic

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398082 )

Change subject: Update section validation logic
..

Update section validation logic

1) Log warnings rather than throwing errors, and
2) Only for sections with IDs >= 0 (i.e., not non-editable or pseudo-
   sections).

Bug: T182774
Change-Id: Icac8b8899b91401b5ef85e37a29d97f70b755eca
---
M lib/parsoid-access.js
M lib/parsoidSections.js
M lib/parsoidSectionsUsingSectionTags.js
M test/lib/parsoid/parsoid-sections-section-elements-tests.js
4 files changed, 36 insertions(+), 27 deletions(-)


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

diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index ba16da9..8633db3 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -129,7 +129,7 @@
 transforms.stripUnneededMarkup(doc, legacy);
 parsoidSections.addSectionDivs(doc);
 
-page.sections = parsoidSections.getSectionsText(doc);
+page.sections = parsoidSections.getSectionsText(doc, req.logger);
 return page;
 });
 }
diff --git a/lib/parsoidSections.js b/lib/parsoidSections.js
index dcdbb72..f8e21d6 100644
--- a/lib/parsoidSections.js
+++ b/lib/parsoidSections.js
@@ -27,13 +27,14 @@
  * Gets the sections array, including HTML string and metadata for all sections
  * (id, anchor, line, toclevel).
  * @param {!document} doc the parsed DOM Document of the Parsoid output
+ * @param {!Logger} logger the app's bunyan logger
  * @return {!sections[]} an array of section JSON elements
  */
-function getSectionsText(doc) {
+function getSectionsText(doc, logger) {
 if (!hasParsoidSections(doc)) {
 return parsoidSectionsUsingDivs.getSectionsText(doc);
 } else {
-return parsoidSectionsUsingSectionTags.getSectionsText(doc);
+return parsoidSectionsUsingSectionTags.getSectionsText(doc, logger);
 }
 }
 
diff --git a/lib/parsoidSectionsUsingSectionTags.js 
b/lib/parsoidSectionsUsingSectionTags.js
index 76e471d..5582972 100644
--- a/lib/parsoidSectionsUsingSectionTags.js
+++ b/lib/parsoidSectionsUsingSectionTags.js
@@ -1,8 +1,6 @@
 'use strict';
 
 const parsoidDomUtils = require('parsoid-dom-utils');
-// const sUtil = require('./util');
-// const HTTPError = sUtil.HTTPError;
 const NodeType = require('./nodeType');
 
 /**
@@ -39,7 +37,11 @@
 }
 }
 
-/* function throwIfPreviousSectionIsIncomplete(allSections, sectionObj) {
+function shouldLogInvalidSectionWarning(allSections, sectionObj) {
+return allSections.length > 1 && sectionObj.id >= 0 && !sectionObj.line && 
!sectionObj.anchor;
+}
+
+function validatePreviousSection(logger, allSections, sectionObj) {
 if (allSections.length === 0) {
 return;
 }
@@ -49,28 +51,28 @@
 }
 // skip lead sections since they don't have headings;
 // no line and no anchor means incomplete section
-if (allSections.length > 1 && !sectionObj.line && !sectionObj.anchor) {
-throw new HTTPError({
-status: 502,
-type: 'unsupported_section',
-title: 'Section structure not supported',
+if (shouldLogInvalidSectionWarning(allSections, sectionObj)) {
+logger.warn({
+warning: 'invalid_section',
+title: 'Found section without expected heading',
 detail: `Cannot find heading for section number ${sectionObj.id}.`
 });
 }
-} */
+}
 
 /**
  * Visits one DOM node. Do the stuff that needs to be done when a single DOM 
node is handled.
  * In this case, starts a new section object when a  tag is 
encountered that is a
  * direct descendant
+ * @param {!Logger} logger the app's bunyan logger
  * @param {!DOMNode} node the node to visit
  * @param {!Object[]} allSections the array containing the results
  * @param {!Object} state some state to pass around
  */
-function visit(node, allSections, state) {
+function visit(logger, node, allSections, state) {
 let sectionObj = allSections.length > 0 ? allSections[allSections.length - 
1] : undefined;
 if (node.tagName === 'SECTION') {
-// throwIfPreviousSectionIsIncomplete(allSections, sectionObj);
+validatePreviousSection(logger, allSections, sectionObj);
 
 sectionObj = { id: getSectionNumber(node), text: '' };
 allSections.push(sectionObj);
@@ -99,16 +101,17 @@
  * This started out with a traditional iterative DFS algorithm but added a 
boolean to stop
  * descending so we don't duplicate content since elsewhere outerHTML is used 
(which contains
  * content of sub-nodes).
+ * @param {!Logger} logger the app's bunyan logger
  * @param {!DOMElement} rootElement the root of the DOM tree which needs to be 
traversed
  * @param {!Object[]} allSections holds the results
  */
-function traverseDF(rootElement, allSections) {
+function traverseDF(logger, rootElement, 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Restore diff tests

2017-12-13 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398040 )

Change subject: Restore diff tests
..

Restore diff tests

Change-Id: I77d6fa8167c31829320860eed7340ed5e4007b2b
---
M lib/feed/featured-image.js
M test/diff/diff.js
M test/diff/results/media_image_featured-enwiki-2016-04-29.json
3 files changed, 3 insertions(+), 4 deletions(-)


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

diff --git a/lib/feed/featured-image.js b/lib/feed/featured-image.js
index ba812dc..fd04030 100644
--- a/lib/feed/featured-image.js
+++ b/lib/feed/featured-image.js
@@ -167,8 +167,7 @@
 
 const lang = mUtil.getLanguageFromDomain(req.params.domain);
 let ret;
-return requestPictureOfTheDay(app, dateUtil.getRequestedDate(req),
-aggregated)
+return requestPictureOfTheDay(app, dateUtil.getRequestedDate(req), 
aggregated)
 .then((response) => {
 mwapi.checkForQueryPagesInResponse(req, response);
 const page = getPageObject(response);
diff --git a/test/diff/diff.js b/test/diff/diff.js
index 0636b43..dc3075f 100644
--- a/test/diff/diff.js
+++ b/test/diff/diff.js
@@ -6,7 +6,7 @@
 const server = require('../utils/server.js');
 const testSpec = require('./test-spec');
 
-describe.skip('diff', function() {
+describe('diff', function() {
 
 this.timeout(2); // eslint-disable-line no-invalid-this
 
diff --git a/test/diff/results/media_image_featured-enwiki-2016-04-29.json 
b/test/diff/results/media_image_featured-enwiki-2016-04-29.json
index 4aea35e..3c22f5e 100644
--- a/test/diff/results/media_image_featured-enwiki-2016-04-29.json
+++ b/test/diff/results/media_image_featured-enwiki-2016-04-29.json
@@ -12,6 +12,6 @@
   },
   "description": {
 "lang": "en",
-"text": "Head shaman of https://en.wikipedia.org/wiki/Olkhon%20Island\; title=\"en:Olkhon 
Island\">Olkhon at https://en.wikipedia.org/wiki/Lake%20Baikal\; title=\"en:Lake 
Baikal\">Lake Baikal. Buryatia, Russia."
+"text": "Head shaman of https://en.wikipedia.org/wiki/Olkhon%20Island\; title=\"en:Olkhon 
Island\">Olkhon at https://en.wikipedia.org/wiki/Lake%20Baikal\; title=\"en:Lake 
Baikal\">Lake Baikal. Buryatia, Russia."
   }
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77d6fa8167c31829320860eed7340ed5e4007b2b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Mark items in MW galleries with gallery IDs

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397994 )

Change subject: Media: Mark items in MW galleries with gallery IDs
..

Media: Mark items in MW galleries with gallery IDs

Bug: T177430
Change-Id: I4c448aeda6f7d6dd42f85aff7a5c4be2654f2940
---
M lib/media.js
M test/diff/results/page_media-enwiki-Hummingbird.json
2 files changed, 17 insertions(+), 0 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index ca11c4c..da71dd1 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -66,6 +66,8 @@
 };
 const section = elem.closest('section') || undefined;
 const sectionId = section && 
parseInt(section.getAttribute('data-mw-section-id'), 10);
+const gallery = elem.closest('.gallery') || undefined;
+const galleryId = gallery && gallery.getAttribute('id');
 let title = resource && 
resource.getAttribute('resource').replace(/^.\//, '');
 let startTime;
 let endTime;
@@ -109,6 +111,7 @@
 end_time: endTime,
 thumb_time: thumbTime,
 audio_type: audioType,
+gallery_id: galleryId,
 sources
 };
 });
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index e3a50d5..784b995 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -87,6 +87,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAQU",
   "titles": {
 "canonical": "File:Hummingbird_Incubating3.jpg",
 "normalized": "File:Hummingbird Incubating3.jpg",
@@ -113,6 +114,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAQU",
   "titles": {
 "canonical": 
"File:Hummingbird_nest_with_two_chicks_in_Santa_Monica,_CA._Photo_taken_June_26,_2006.jpg",
 "normalized": "File:Hummingbird nest with two chicks in Santa Monica, 
CA. Photo taken June 26, 2006.jpg",
@@ -138,6 +140,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAQU",
   "titles": {
 "canonical": "File:Calliope-nest_edit.jpg",
 "normalized": "File:Calliope-nest edit.jpg",
@@ -496,6 +499,7 @@
 },
 {
   "type": "video",
+  "gallery_id": "mwAi0",
   "sources": [
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/f/fe/Humming_birds_feeding_at_1500fps.webm;,
@@ -571,6 +575,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": "File:Hummingbird_feeding.jpg",
 "normalized": "File:Hummingbird feeding.jpg",
@@ -597,6 +602,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": "File:Hummingbird_headshot.jpg",
 "normalized": "File:Hummingbird headshot.jpg",
@@ -623,6 +629,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": "File:Eugenes-fulgens-001.jpg",
 "normalized": "File:Eugenes-fulgens-001.jpg",
@@ -649,6 +656,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": "File:Hummingbird.jpg",
 "normalized": "File:Hummingbird.jpg",
@@ -674,6 +682,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": 
"File:Juvenile_Annas_Hummingbird_at_San_Francisco_Botanical_Garden_-_Stierch_-_E.jpg",
 "normalized": "File:Juvenile Annas Hummingbird at San Francisco 
Botanical Garden - Stierch - E.jpg",
@@ -700,6 +709,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": "File:Hummingbird_Calypte_anna_in_ggp_15n.jpg",
 "normalized": "File:Hummingbird Calypte anna in ggp 15n.jpg",
@@ -726,6 +736,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": "File:Nano_Hummingbird.jpg",
 "normalized": "File:Nano Hummingbird.jpg",
@@ -751,6 +762,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": 
"File:Hummingbird_Chicks_in_Nest_in_Cactus_in_Mesa,_Arizona.jpg",
 "normalized": "File:Hummingbird Chicks in Nest in Cactus in Mesa, 
Arizona.jpg",
@@ -777,6 +789,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": 
"File:Hummingbird_Adult_in_Nest_in_Cactus_in_Mesa,_Arizona.jpg",
 "normalized": "File:Hummingbird Adult in Nest in Cactus in Mesa, 
Arizona.jpg",
@@ -803,6 +816,7 @@
 },
 {
   "type": "image",
+  "gallery_id": "mwAi0",
   "titles": {
 "canonical": 

[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to bfc3588

2017-12-12 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/397987 )

Change subject: Update mobileapps to bfc3588
..


Update mobileapps to bfc3588

List of changes:
f117270 Fix news tests and reenable monitoring
bfc3588 Hygiene: Prune old news test fixtures
xxx Update node module dependencies

Change-Id: Icf7b8c561d1bbadd763c615c86a35f1421d2c485
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mholloway: Verified; Looks good to me, approved



diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 5a12100..bafd7e0 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "59d4bdcb9a0e95b5d9c6a3bd9e9f4b562ac8a509",
+  "_shasum": "d3b44e3ead73d28f27742b4f4f679aaa13043278",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 577f349..63e4d3b 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "868ce5edc8de7e54d918caf79a5b3b30237e66b1",
+  "_shasum": "c9fc70b93cfdcce4bc17f48ef0a66cd1273f6613",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 94f267b..bfc3588 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 94f267b3a733ac4a49614f2995d743df530fd88a
+Subproject commit bfc3588f79b368c8ecb812fc2c763f058c69d1ff

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf7b8c561d1bbadd763c615c86a35f1421d2c485
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to bfc3588

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397987 )

Change subject: Update mobileapps to bfc3588
..

Update mobileapps to bfc3588

List of changes:
f117270 Fix news tests and reenable monitoring
bfc3588 Hygiene: Prune old news test fixtures
xxx Update node module dependencies

Change-Id: Icf7b8c561d1bbadd763c615c86a35f1421d2c485
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/87/397987/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 5a12100..bafd7e0 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "59d4bdcb9a0e95b5d9c6a3bd9e9f4b562ac8a509",
+  "_shasum": "d3b44e3ead73d28f27742b4f4f679aaa13043278",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 577f349..63e4d3b 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "868ce5edc8de7e54d918caf79a5b3b30237e66b1",
+  "_shasum": "c9fc70b93cfdcce4bc17f48ef0a66cd1273f6613",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 94f267b..bfc3588 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 94f267b3a733ac4a49614f2995d743df530fd88a
+Subproject commit bfc3588f79b368c8ecb812fc2c763f058c69d1ff

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf7b8c561d1bbadd763c615c86a35f1421d2c485
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Prune old news test fixtures

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397981 )

Change subject: Hygiene: Prune old news test fixtures
..

Hygiene: Prune old news test fixtures

Change-Id: I97888ea9d37dff9dcc1756b21abc19be7c6c7e82
---
D test/fixtures/news-site-da-2016-11-30.htm
D test/fixtures/news-site-da-2017-10-04.htm
D test/fixtures/news-site-de-2016-11-30.htm
D test/fixtures/news-site-de-2017-10-04.htm
D test/fixtures/news-site-el-2016-11-30.htm
D test/fixtures/news-site-el-2017-10-04.htm
D test/fixtures/news-site-en-2016-11-30.htm
D test/fixtures/news-site-en-2017-10-04.htm
D test/fixtures/news-site-es-2016-11-30.htm
D test/fixtures/news-site-es-2017-10-04.htm
D test/fixtures/news-site-fi-2016-11-30.htm
D test/fixtures/news-site-fi-2017-10-04.htm
D test/fixtures/news-site-fr-2016-11-30.htm
D test/fixtures/news-site-fr-2017-10-04.htm
D test/fixtures/news-site-he-2016-11-30.htm
D test/fixtures/news-site-he-2017-10-04.htm
D test/fixtures/news-site-ko-2016-11-30.htm
D test/fixtures/news-site-ko-2017-10-04.htm
D test/fixtures/news-site-no-2016-11-30.htm
D test/fixtures/news-site-no-2017-10-04.htm
D test/fixtures/news-site-pl-2016-11-30.htm
D test/fixtures/news-site-pl-2017-10-04.htm
D test/fixtures/news-site-pt-2016-11-30.htm
D test/fixtures/news-site-pt-2017-10-04.htm
D test/fixtures/news-site-ru-2016-11-30.htm
D test/fixtures/news-site-ru-2017-10-04.htm
D test/fixtures/news-site-sco-2016-11-30.htm
D test/fixtures/news-site-sco-2017-10-04.htm
D test/fixtures/news-site-sv-2016-11-30.htm
D test/fixtures/news-site-sv-2017-10-04.htm
D test/fixtures/news-site-vi-2016-11-30.htm
D test/fixtures/news-site-vi-2017-10-04.htm
32 files changed, 0 insertions(+), 2,406 deletions(-)


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


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97888ea9d37dff9dcc1756b21abc19be7c6c7e82
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix news tests and reenable monitoring

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397980 )

Change subject: Fix news tests and reenable monitoring
..

Fix news tests and reenable monitoring

Change-Id: I1cf4832e01ab56c3a86ed50b20a5fb4818e7251b
---
M etc/feed/news-sites.js
M spec.yaml
M test/features/news/news-sites.js
M test/features/news/news.js
A test/fixtures/news-site-da-2017-12-12.htm
A test/fixtures/news-site-de-2017-12-12.htm
A test/fixtures/news-site-el-2017-12-12.htm
A test/fixtures/news-site-en-2017-12-12.htm
A test/fixtures/news-site-es-2017-12-12.htm
A test/fixtures/news-site-fi-2017-12-12.htm
A test/fixtures/news-site-fr-2017-12-12.htm
A test/fixtures/news-site-he-2017-12-12.htm
A test/fixtures/news-site-ko-2017-12-12.htm
A test/fixtures/news-site-no-2017-12-12.htm
A test/fixtures/news-site-pl-2017-12-12.htm
A test/fixtures/news-site-pt-2017-12-12.htm
A test/fixtures/news-site-ru-2017-12-12.htm
A test/fixtures/news-site-sco-2017-12-12.htm
A test/fixtures/news-site-sv-2017-12-12.htm
A test/fixtures/news-site-vi-2017-12-12.htm
20 files changed, 1,227 insertions(+), 32 deletions(-)


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


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cf4832e01ab56c3a86ed50b20a5fb4818e7251b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 94f267b

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397969 )

Change subject: Update mobileapps to 94f267b
..

Update mobileapps to 94f267b

List of changes:
75d1d7b Fix onthisday with section tags
751845a Bump onthisday version.
94f267b Bump definitions version and sync spec versions
xxx Update node module dependencies

Change-Id: Ia446a2189fe8fa090a27488dad346802b998e142
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/69/397969/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 6fd2f7b..5a12100 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "0a1f3ec3192e7e4c49b985e3ebd1e6905d9f2d2d",
+  "_shasum": "59d4bdcb9a0e95b5d9c6a3bd9e9f4b562ac8a509",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 958f485..577f349 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "475d668797333230228ec38595ff831f6520650b",
+  "_shasum": "868ce5edc8de7e54d918caf79a5b3b30237e66b1",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index d0ee651..94f267b 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit d0ee65120d6a4b52a232c056508b82001431f432
+Subproject commit 94f267b3a733ac4a49614f2995d743df530fd88a

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia446a2189fe8fa090a27488dad346802b998e142
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Revert "Update mobileapps to d0ee651"

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397965 )

Change subject: Revert "Update mobileapps to d0ee651"
..

Revert "Update mobileapps to d0ee651"

This reverts commit 28bfda34d0c8ff543cec392a6c8a2186c12e502e.

Change-Id: Ibe21bdac31879a77cdcb5a42d1b49ab7efb44870
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/65/397965/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 6fd2f7b..008df1d 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "0a1f3ec3192e7e4c49b985e3ebd1e6905d9f2d2d",
+  "_shasum": "1a0b533550ebd56cd7fde69badbae6c7ac5e12a7",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 958f485..3ee47b8 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "475d668797333230228ec38595ff831f6520650b",
+  "_shasum": "908d5defcbcdd2a871a6060692f55c88104ffb5c",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index d0ee651..172abc7 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit d0ee65120d6a4b52a232c056508b82001431f432
+Subproject commit 172abc7424d0a7042e027506f5f4979553a40a3b

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe21bdac31879a77cdcb5a42d1b49ab7efb44870
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Bump definitions version and sync spec versions

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397964 )

Change subject: Bump definitions version and sync spec versions
..

Bump definitions version and sync spec versions

Change-Id: I78466c8ec9ba8fde5d0eef6f11decc3d52268d25
---
M lib/mobile-util.js
M spec.yaml
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 3d9e28a..c088707 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -14,7 +14,7 @@
 media: { name: 'Media', version: '1.0.0' },
 readHtml: { name: 'ReadHtml', version: '0.1.0' },
 summary: { name: 'Summary', version: '1.3.0' },
-definition: { name: 'definition', version: '0.7.3' },
+definition: { name: 'definition', version: '0.7.4' },
 random: { name: 'random', version: '0.6.0' },
 announcements: { name: 'announcements', version: '0.1.0' },
 compilations: { name: 'compilations', version: '0.1.0' },
diff --git a/spec.yaml b/spec.yaml
index 0d42039..b3838f0 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -139,7 +139,7 @@
  - Holidays: a list of fixed holidays celebrated on the provided day 
and month
  - Events: a list of significant events which happened on the provided 
day and month and which are not covered by the other types yet
   produces:
-- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/onthisday/0.3.1;
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/onthisday/0.3.2;
   parameters:
 - name: type
   in: path
@@ -607,7 +607,7 @@
 - Wiktionary definition of {title}
   description: Gets definitions parsed from Wiktionary for {title}
   produces:
-- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/definition/0.7.3;
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/definition/0.7.4;
   x-amples:
 - title: retrieve en-wiktionary definitions for 'cat'
   request:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78466c8ec9ba8fde5d0eef6f11decc3d52268d25
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to d0ee651

2017-12-12 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/397924 )

Change subject: Update mobileapps to d0ee651
..


Update mobileapps to d0ee651

List of changes:
d0ee651 Fix definition endpoint 500s
xxx Update node module dependencies

Change-Id: I81c5e60323909df7c3d27cf3a9a0a0ddb327f89f
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Mholloway: Verified; Looks good to me, approved



diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 008df1d..6fd2f7b 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "1a0b533550ebd56cd7fde69badbae6c7ac5e12a7",
+  "_shasum": "0a1f3ec3192e7e4c49b985e3ebd1e6905d9f2d2d",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 3ee47b8..958f485 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "908d5defcbcdd2a871a6060692f55c88104ffb5c",
+  "_shasum": "475d668797333230228ec38595ff831f6520650b",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 172abc7..d0ee651 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 172abc7424d0a7042e027506f5f4979553a40a3b
+Subproject commit d0ee65120d6a4b52a232c056508b82001431f432

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I81c5e60323909df7c3d27cf3a9a0a0ddb327f89f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to d0ee651

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397924 )

Change subject: Update mobileapps to d0ee651
..

Update mobileapps to d0ee651

List of changes:
d0ee651 Fix definition endpoint 500s
xxx Update node module dependencies

Change-Id: I81c5e60323909df7c3d27cf3a9a0a0ddb327f89f
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/24/397924/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 008df1d..6fd2f7b 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "1a0b533550ebd56cd7fde69badbae6c7ac5e12a7",
+  "_shasum": "0a1f3ec3192e7e4c49b985e3ebd1e6905d9f2d2d",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 3ee47b8..958f485 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "908d5defcbcdd2a871a6060692f55c88104ffb5c",
+  "_shasum": "475d668797333230228ec38595ff831f6520650b",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 172abc7..d0ee651 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 172abc7424d0a7042e027506f5f4979553a40a3b
+Subproject commit d0ee65120d6a4b52a232c056508b82001431f432

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81c5e60323909df7c3d27cf3a9a0a0ddb327f89f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix definition endpoint 500s

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397921 )

Change subject: Fix definition endpoint 500s
..

Fix definition endpoint 500s

querySelectorAll returns a NodeList and not an Array.  NodeLists don't
have a forEach method. We have to use Array.prototype.call.

Bug: T182715
Change-Id: I84e39215b8135ff88441448bb57cba5c5efaa5ac
---
M lib/parseDefinitionsUsingSectionTags.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/lib/parseDefinitionsUsingSectionTags.js 
b/lib/parseDefinitionsUsingSectionTags.js
index 87bf7f0..1cafda8 100644
--- a/lib/parseDefinitionsUsingSectionTags.js
+++ b/lib/parseDefinitionsUsingSectionTags.js
@@ -85,7 +85,7 @@
 currentDefinition.definition = html.substring(0, 
html.indexOf(' {
+[].forEach.call(examples, (example) => {
 currentDefinition.examples.push(example.innerHTML.trim());
 });
 } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I84e39215b8135ff88441448bb57cba5c5efaa5ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 172abc7

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397910 )

Change subject: Update mobileapps to 172abc7
..

Update mobileapps to 172abc7

List of changes:
172abc7 Do not monitor page/news
xxx Update node module dependencies

Change-Id: I727605c991ad83a456150fcbf75b21d4907538fc
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/10/397910/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 8011b2a..008df1d 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "d05fce7a2ad95f4f55d9ad7905a81eaaecba21b6",
+  "_shasum": "1a0b533550ebd56cd7fde69badbae6c7ac5e12a7",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index a1419c0..3ee47b8 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "bf1e6146d49a5d178dbe1e64d49a83abf91eec5e",
+  "_shasum": "908d5defcbcdd2a871a6060692f55c88104ffb5c",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 035608d..172abc7 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 035608dbf528acef7f21d5720b3cb4fa9d4805c6
+Subproject commit 172abc7424d0a7042e027506f5f4979553a40a3b

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I727605c991ad83a456150fcbf75b21d4907538fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 172abc7

2017-12-12 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/397910 )

Change subject: Update mobileapps to 172abc7
..


Update mobileapps to 172abc7

List of changes:
172abc7 Do not monitor page/news
xxx Update node module dependencies

Change-Id: I727605c991ad83a456150fcbf75b21d4907538fc
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Mholloway: Verified; Looks good to me, approved



diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index 8011b2a..008df1d 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "d05fce7a2ad95f4f55d9ad7905a81eaaecba21b6",
+  "_shasum": "1a0b533550ebd56cd7fde69badbae6c7ac5e12a7",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index a1419c0..3ee47b8 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "bf1e6146d49a5d178dbe1e64d49a83abf91eec5e",
+  "_shasum": "908d5defcbcdd2a871a6060692f55c88104ffb5c",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 035608d..172abc7 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 035608dbf528acef7f21d5720b3cb4fa9d4805c6
+Subproject commit 172abc7424d0a7042e027506f5f4979553a40a3b

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I727605c991ad83a456150fcbf75b21d4907538fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 035608d

2017-12-12 Thread Mholloway (Code Review)
Mholloway has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/397907 )

Change subject: Update mobileapps to 035608d
..


Update mobileapps to 035608d

List of changes:
035608d Temporarily skip throwIfPreviousSectionIsIncomplete
xxx Update node module dependencies

Change-Id: I4d65c7bc5df040065751ce935aa01a76887c2669
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Mholloway: Verified; Looks good to me, approved



diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index bc75766..8011b2a 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "141c566b345357d66cdcce099e69523c06e2846e",
+  "_shasum": "d05fce7a2ad95f4f55d9ad7905a81eaaecba21b6",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 4e9c237..a1419c0 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "15d4a2532e292ebada2dec43f24bcc7f7d36c23c",
+  "_shasum": "bf1e6146d49a5d178dbe1e64d49a83abf91eec5e",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 5b8796d..035608d 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 5b8796d8ee040cc0c5404670ed53ecb89ab93d30
+Subproject commit 035608dbf528acef7f21d5720b3cb4fa9d4805c6

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4d65c7bc5df040065751ce935aa01a76887c2669
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 035608d

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397907 )

Change subject: Update mobileapps to 035608d
..

Update mobileapps to 035608d

List of changes:
035608d Temporarily skip throwIfPreviousSectionIsIncomplete
xxx Update node module dependencies

Change-Id: I4d65c7bc5df040065751ce935aa01a76887c2669
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/07/397907/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index bc75766..8011b2a 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "141c566b345357d66cdcce099e69523c06e2846e",
+  "_shasum": "d05fce7a2ad95f4f55d9ad7905a81eaaecba21b6",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 4e9c237..a1419c0 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "15d4a2532e292ebada2dec43f24bcc7f7d36c23c",
+  "_shasum": "bf1e6146d49a5d178dbe1e64d49a83abf91eec5e",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 5b8796d..035608d 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 5b8796d8ee040cc0c5404670ed53ecb89ab93d30
+Subproject commit 035608dbf528acef7f21d5720b3cb4fa9d4805c6

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d65c7bc5df040065751ce935aa01a76887c2669
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Temporarily skip throwIfPreviousSectionIsIncomplete

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397905 )

Change subject: Temporarily skip throwIfPreviousSectionIsIncomplete
..

Temporarily skip throwIfPreviousSectionIsIncomplete

Skip checking for section.line and section.anchor in order to complete
our coordinated deployment. We'll come back and fix this asap.

Change-Id: I88c08d4636803d64e51835067dd75164f68a8eb5
---
M lib/parsoidSectionsUsingSectionTags.js
M test/lib/parsoid/parsoid-sections-section-elements-tests.js
2 files changed, 7 insertions(+), 7 deletions(-)


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

diff --git a/lib/parsoidSectionsUsingSectionTags.js 
b/lib/parsoidSectionsUsingSectionTags.js
index 7d20fdd..76e471d 100644
--- a/lib/parsoidSectionsUsingSectionTags.js
+++ b/lib/parsoidSectionsUsingSectionTags.js
@@ -1,8 +1,8 @@
 'use strict';
 
 const parsoidDomUtils = require('parsoid-dom-utils');
-const sUtil = require('./util');
-const HTTPError = sUtil.HTTPError;
+// const sUtil = require('./util');
+// const HTTPError = sUtil.HTTPError;
 const NodeType = require('./nodeType');
 
 /**
@@ -39,7 +39,7 @@
 }
 }
 
-function throwIfPreviousSectionIsIncomplete(allSections, sectionObj) {
+/* function throwIfPreviousSectionIsIncomplete(allSections, sectionObj) {
 if (allSections.length === 0) {
 return;
 }
@@ -57,7 +57,7 @@
 detail: `Cannot find heading for section number ${sectionObj.id}.`
 });
 }
-}
+} */
 
 /**
  * Visits one DOM node. Do the stuff that needs to be done when a single DOM 
node is handled.
@@ -70,7 +70,7 @@
 function visit(node, allSections, state) {
 let sectionObj = allSections.length > 0 ? allSections[allSections.length - 
1] : undefined;
 if (node.tagName === 'SECTION') {
-throwIfPreviousSectionIsIncomplete(allSections, sectionObj);
+// throwIfPreviousSectionIsIncomplete(allSections, sectionObj);
 
 sectionObj = { id: getSectionNumber(node), text: '' };
 allSections.push(sectionObj);
@@ -117,7 +117,7 @@
 }
 }
 ensureLeadSection(allSections);
-throwIfPreviousSectionIsIncomplete(allSections);
+// throwIfPreviousSectionIsIncomplete(allSections);
 }
 
 function getSectionsText(doc) {
diff --git a/test/lib/parsoid/parsoid-sections-section-elements-tests.js 
b/test/lib/parsoid/parsoid-sections-section-elements-tests.js
index 4ba24df..77cb023 100644
--- a/test/lib/parsoid/parsoid-sections-section-elements-tests.js
+++ b/test/lib/parsoid/parsoid-sections-section-elements-tests.js
@@ -119,7 +119,7 @@
 assertSection0(sections, sectionInDiv);
 });
 
-it('non-lead section without heading tag should throw error', () => {
+it.skip('non-lead section without heading tag should throw error', () => {
 const doc = domino.createDocument(
 'text0' +
 'text1');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88c08d4636803d64e51835067dd75164f68a8eb5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 5b8796d

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397881 )

Change subject: Update mobileapps to 5b8796d
..

Update mobileapps to 5b8796d

List of changes:
f000b0c Revert "Revert "Bump mobile-sections and definitions version""
0d67e0d Fix summary responses for pages with empty intros
57feb4e Fix: .noexcerpts -> .noexcerpt
ccce0c9 Summary: Strip elements with class 'noprint'
066b379 Change Parsoid version requested to 1.6.0
55b99a7 Fill in remaining content format versions in spec.yaml
5b8796d Temporarily make the media_item spec less restrictive
xxx Update node module dependencies

Change-Id: Ie1c43d97901c287fce5a4e660c44edae44e4e216
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/81/397881/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index c5708f1..bc75766 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "5f5c6d52ee716664bdd13227e8e69a6286e6a9d5",
+  "_shasum": "141c566b345357d66cdcce099e69523c06e2846e",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 8d36901..4e9c237 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "2db7370d391b424b5fabb26adf9a19995dc530f1",
+  "_shasum": "15d4a2532e292ebada2dec43f24bcc7f7d36c23c",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index e290b17..5b8796d 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit e290b179a34d996cf5bbcee714a71d5d85a27d07
+Subproject commit 5b8796d8ee040cc0c5404670ed53ecb89ab93d30

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1c43d97901c287fce5a4e660c44edae44e4e216
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Temporarily make the media_item spec less restrictive

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397871 )

Change subject: Temporarily make the media_item spec less restrictive
..

Temporarily make the media_item spec less restrictive

Temporarily let this have additional properties so that it doesn't start
alerting shortly after Parsoid sections are deployed but before we've had
a chance to update the spec.

Change-Id: I48ef2dda7ad84ca860291e2379ea6a35a608f384
---
M spec.yaml
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/spec.yaml b/spec.yaml
index 80e6897..1850994 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -1393,7 +1393,6 @@
   - type
   - thumbnail
   - license
-additionalProperties: false
 
   action:
 type: object

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48ef2dda7ad84ca860291e2379ea6a35a608f384
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fill in remaining content format versions in spec.yaml

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397849 )

Change subject: Fill in remaining content format versions in spec.yaml
..

Fill in remaining content format versions in spec.yaml

Change-Id: Ia60dd9b7eb6b0576a162ce0e22c051ad19e85467
---
M spec.yaml
1 file changed, 10 insertions(+), 10 deletions(-)


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

diff --git a/spec.yaml b/spec.yaml
index bd199b8..c556a64 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -1,7 +1,7 @@
 swagger: '2.0'
 
 info:
-  version: 0.1.0
+  version: 0.3.0
   title: WMF MobileApps service
   description: A prototype for MediaWiki REST API services for mobile apps
   termsOfService: https://wikimediafoundation.org/wiki/Terms_of_Use
@@ -68,7 +68,7 @@
 - Announcements for apps
   description: Gets announcements for display in the official Wikipedia 
iOS and Android apps
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/announcements/0.1.0;
   responses:
 '200':
   description: Announcements for the given Wiki
@@ -105,7 +105,7 @@
 - Offline compilations
   description: Gets information about the offline compilations available 
for download
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/compilations/0.1.0;
   responses:
 '200':
   description: Offline compilation information
@@ -139,7 +139,7 @@
  - Holidays: a list of fixed holidays celebrated on the provided day 
and month
  - Events: a list of significant events which happened on the provided 
day and month and which are not covered by the other types yet
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/onthisday/1.3.1;
   parameters:
 - name: type
   in: path
@@ -491,7 +491,7 @@
 - Random article title
   description: Gets the title of a randomly picked article from main 
namespace. Preference is given to articles with a thumbnail, long extract, and 
an associated Wikidata description.
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/random/0.6.0;
   responses:
 '200':
   description: A random (good) article title
@@ -567,7 +567,7 @@
 - Media items on a given page
   description: Gets the media items (images, audio, and video) which 
appear on a given wiki page
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/Media/1.0.0;
   responses:
 '200':
   description: Gets media items from a wiki page
@@ -606,7 +606,7 @@
 - Wiktionary definition of {title}
   description: Gets definitions parsed from Wiktionary for {title}
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/definition/0.7.3;
   x-amples:
 - title: retrieve en-wiktionary definitions for 'cat'
   request:
@@ -786,7 +786,7 @@
 - Page content
   description: Gets the full page content of a given wiki page for mobile 
apps
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/mobile-sections/1.3.1;
   x-amples:
 - title: retrieve en.wp main page via mobile-sections
   request:
@@ -820,7 +820,7 @@
 - Lead section of page content
   description: Gets the lead section and general metadata of a given wiki 
page for mobile apps
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/mobile-sections/1.3.1;
   x-amples:
 - title: retrieve lead section of en.wp Altrincham page via 
mobile-sections-lead
   request:
@@ -858,7 +858,7 @@
 - Lead section of page content
   description: Gets the remaining sections of a given wiki page for mobile 
apps
   produces:
-- application/json
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/mobile-sections/1.3.1;
   x-monitor: false
 
 definitions:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia60dd9b7eb6b0576a162ce0e22c051ad19e85467
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Change Parsoid version requested to 1.6.0

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397845 )

Change subject: Change Parsoid version requested to 1.6.0
..

Change Parsoid version requested to 1.6.0

Also update the summary profile version reported in spec.yaml

Change-Id: Idf887aaa57bc6087319f758e4dcda98b572bad11
---
M lib/parsoid-access.js
M spec.yaml
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index 7d84e15..ba16da9 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -15,7 +15,7 @@
 const HTTPError = sUtil.HTTPError;
 
 const PARSOID_ACCEPT_HEADER
-= 'text/html; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/HTML/1.5.0;';
+= 'text/html; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/HTML/1.6.0;';
 
 /**
  * @param {!Object} app the application object
diff --git a/spec.yaml b/spec.yaml
index 8f13170..bd199b8 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -631,7 +631,7 @@
 
 Stability: 
[unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)
   produces:
-- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/Summary/1.2.0;
+- application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/Summary/1.3.0;
   parameters:
 - name: title
   in: path

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf887aaa57bc6087319f758e4dcda98b572bad11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Add video derivative sizes

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397841 )

Change subject: Media: Add video derivative sizes
..

Media: Add video derivative sizes

Bug: T177430
Change-Id: Ib2a1db158f72d1d8067df4baf7296fa8ca67beca
---
M lib/media.js
M test/diff/results/page_media-enwiki-Hummingbird.json
2 files changed, 40 insertions(+), 14 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index ca11c4c..269a51e 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -88,8 +88,10 @@
 codecs: source.getAttribute('type').split('; 
')[1].split('\"')[1].split(', '),
 name: source.getAttribute('data-title'),
 short_name: source.getAttribute('data-shorttitle'),
-width: source.getAttribute('data-file-width') || undefined,
-height: source.getAttribute('data-file-height') || 
undefined
+// eslint-disable-next-line max-len
+width: source.getAttribute('data-file-width') || 
source.getAttribute('data-width'),
+// eslint-disable-next-line max-len
+height: source.getAttribute('data-file-height') || 
source.getAttribute('data-height')
 };
 });
 } else if (mediaType === Audio) {
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index e3a50d5..176e929 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -249,7 +249,9 @@
 "vorbis"
   ],
   "name": "Low bandwidth WebM (160P)",
-  "short_name": "WebM 160P"
+  "short_name": "WebM 160P",
+  "width": "288",
+  "height": "160"
 },
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.240p.webm;,
@@ -259,7 +261,9 @@
 "vorbis"
   ],
   "name": "Small WebM (240P)",
-  "short_name": "WebM 240P"
+  "short_name": "WebM 240P",
+  "width": "426",
+  "height": "236"
 },
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.360p.webm;,
@@ -269,7 +273,9 @@
 "vorbis"
   ],
   "name": "WebM (360P)",
-  "short_name": "WebM 360P"
+  "short_name": "WebM 360P",
+  "width": "640",
+  "height": "356"
 },
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.480p.webm;,
@@ -279,7 +285,9 @@
 "vorbis"
   ],
   "name": "SD WebM (480P)",
-  "short_name": "WebM 480P"
+  "short_name": "WebM 480P",
+  "width": "854",
+  "height": "474"
 }
   ],
   "titles": {
@@ -385,7 +393,9 @@
 "vorbis"
   ],
   "name": "Low bandwidth WebM (160P)",
-  "short_name": "WebM 160P"
+  "short_name": "WebM 160P",
+  "width": "284",
+  "height": "160"
 },
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/d/db/Hummingbird.ogv/Hummingbird.ogv.240p.webm;,
@@ -395,7 +405,9 @@
 "vorbis"
   ],
   "name": "Small WebM (240P)",
-  "short_name": "WebM 240P"
+  "short_name": "WebM 240P",
+  "width": "426",
+  "height": "240"
 },
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/d/db/Hummingbird.ogv/Hummingbird.ogv.360p.webm;,
@@ -405,7 +417,9 @@
 "vorbis"
   ],
   "name": "WebM (360P)",
-  "short_name": "WebM 360P"
+  "short_name": "WebM 360P",
+  "width": "640",
+  "height": "360"
 },
 {
   "source": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/d/db/Hummingbird.ogv/Hummingbird.ogv.480p.webm;,
@@ -415,7 +429,9 @@
 "vorbis"
   ],
   "name": "SD WebM (480P)",
-  "short_name": "WebM 480P"
+  "short_name": "WebM 480P",
+  "width": "854",
+  "height": "480"
 }
   ],
   "titles": {
@@ -517,7 +533,9 @@
 "vorbis"
   ],
   "name": "Low bandwidth WebM (160P)",
-  "short_name": "WebM 160P"
+  "short_name": "WebM 160P",
+  "width": "288",
+  "height": "160"
 },
 {
   "source": 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Summary: Strip elements with class 'noprint'

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397830 )

Change subject: Summary: Strip elements with class 'noprint'
..

Summary: Strip elements with class 'noprint'

Bug: T182633
Change-Id: Ic2ca9418906b5202082668fab073d0a585c69fbb
---
M lib/transformations/summarize.js
M test/lib/transformations/summarize.js
2 files changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/lib/transformations/summarize.js b/lib/transformations/summarize.js
index d697522..e0becc8 100644
--- a/lib/transformations/summarize.js
+++ b/lib/transformations/summarize.js
@@ -33,6 +33,7 @@
 removeAttributes(doc, '*', ['data-mw']);
 rmElementsWithSelector(doc, '.mw-ref, .reference');
 rmElementsWithSelector(doc, '.noexcerpt');
+rmElementsWithSelector(doc, '.noprint');
 rmElementsWithSelector(doc, 'math');
 rmElementsWithSelector(doc, 'span:empty,b:empty,i:empty,p:empty');
 
diff --git a/test/lib/transformations/summarize.js 
b/test/lib/transformations/summarize.js
index 8eba664..6c9f3cf 100644
--- a/test/lib/transformations/summarize.js
+++ b/test/lib/transformations/summarize.js
@@ -23,6 +23,11 @@
 'This summary should be nice and clean 
(elements with class "noexcerpt" will be omitted).',
 'This summary should be nice and clean.'
 ],
+// Should strip .noprint
+[
+'This summary should be nice and clean 
(elements with class "noprint" will be omitted).',
+'This summary should be nice and clean.'
+],
 // sup elements are retained
 [
 'A googolplex is the number 10googol, or 
equivalently, 10(10100).',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2ca9418906b5202082668fab073d0a585c69fbb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix: .noexcerpts -> .noexcerpt

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397829 )

Change subject: Fix: .noexcerpts -> .noexcerpt
..

Fix: .noexcerpts -> .noexcerpt

This appears to be a typo. The .noexcerpts class does not appear in any
article HTML that I can find, but .noexcerpt does, and is documented.

https://www.mediawiki.org/wiki/Extension:TextExtracts#How_can_I_remove_content_from_a_page_preview/extract?

Change-Id: I6bb3046fd8580f30252d8cd947cfcccacd0f937e
---
M lib/transformations/summarize.js
M test/lib/transformations/summarize.js
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/lib/transformations/summarize.js b/lib/transformations/summarize.js
index 24f1051..d697522 100644
--- a/lib/transformations/summarize.js
+++ b/lib/transformations/summarize.js
@@ -32,7 +32,7 @@
 flattenElements(doc, 'a');
 removeAttributes(doc, '*', ['data-mw']);
 rmElementsWithSelector(doc, '.mw-ref, .reference');
-rmElementsWithSelector(doc, '.noexcerpts');
+rmElementsWithSelector(doc, '.noexcerpt');
 rmElementsWithSelector(doc, 'math');
 rmElementsWithSelector(doc, 'span:empty,b:empty,i:empty,p:empty');
 
diff --git a/test/lib/transformations/summarize.js 
b/test/lib/transformations/summarize.js
index 53ecde3..c37c9a4 100644
--- a/test/lib/transformations/summarize.js
+++ b/test/lib/transformations/summarize.js
@@ -20,7 +20,7 @@
 ],
 // Should strip .noexcerpts
 [
-'This summary should be nice and clean (noexcerpts will be omitted).',
+'This summary should be nice and clean 
(elements with class "noexcerpt" will be omitted).',
 'This summary should be nice and clean.'
 ],
 // sup elements are retained

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6bb3046fd8580f30252d8cd947cfcccacd0f937e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix summary responses for pages with empty intros

2017-12-12 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397815 )

Change subject: Fix summary responses for pages with empty intros
..

Fix summary responses for pages with empty intros

We recently introduced a bug wherein extract and extract_html properties
were being omitted from the summary response in cases where the lead intro
for the page was empty.  This will restore those properties.

Bug: T182639
Change-Id: I8bca3a8ea96560381b6d1ec562c4fcf555693608
---
M lib/mobile-util.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 0876e3c..443dc01 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -216,7 +216,7 @@
 
 const leadText = domino.createDocument(page.sections[0].text);
 const intro = transforms.extractLeadIntroduction(leadText);
-const summary = intro.length ? transforms.summarize(intro) : intro;
+const summary = intro.length ? transforms.summarize(intro) : { extract: 
'', extract_html: '' };
 
 return Object.assign({
 code: 200,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bca3a8ea96560381b6d1ec562c4fcf555693608
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 9bdcf53

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397708 )

Change subject: Update mobileapps to 9bdcf53
..

Update mobileapps to 9bdcf53

List of changes:
f000b0c Revert "Revert "Bump mobile-sections and definitions version""
xxx Update node module dependencies

Change-Id: I85ef5efc22461a512d379ff94e676a86cf903555
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/08/397708/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index c5708f1..8fb4ff3 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "5f5c6d52ee716664bdd13227e8e69a6286e6a9d5",
+  "_shasum": "1a38c50bf781fea0b1d214c9d96234d22a591a69",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index 8d36901..6b79de6 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "2db7370d391b424b5fabb26adf9a19995dc530f1",
+  "_shasum": "b6d6ffd0baaf041c5e500648421f4b88af44e1f6",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index e290b17..9bdcf53 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit e290b179a34d996cf5bbcee714a71d5d85a27d07
+Subproject commit 9bdcf5332a11a41aae325efb7d00f7bc0b724b7f

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85ef5efc22461a512d379ff94e676a86cf903555
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Revert "Bump mobile-sections and definitions version""

2017-12-11 Thread Mholloway (Code Review)
Hello BearND, Fjalapeno, Ppchelko, Mhurd, jenkins-bot, Jdlrobson,

I'd like you to do a code review.  Please visit

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

to review the following change.


Change subject: Revert "Revert "Bump mobile-sections and definitions version""
..

Revert "Revert "Bump mobile-sections and definitions version""

This reverts commit bd943b98b1acf8c71c44ff1552267215da5cdf95.

Change-Id: I8dad1500d8c1727b77632f984a693baacfb2375d
---
M lib/mobile-util.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index acbccc8..3e9b515 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -10,11 +10,11 @@
 const NS_MAIN = 0;
 
 mUtil.CONTENT_TYPES = {
-mobileSections: { name: 'mobile-sections', version: '0.13.0' },
+mobileSections: { name: 'mobile-sections', version: '0.13.1' },
 media: { name: 'Media', version: '1.0.0' },
 readHtml: { name: 'ReadHtml', version: '0.1.0' },
 summary: { name: 'Summary', version: '1.3.0' },
-definition: { name: 'definition', version: '0.7.2' },
+definition: { name: 'definition', version: '0.7.3' },
 random: { name: 'random', version: '0.6.0' },
 announcements: { name: 'announcements', version: '0.1.0' },
 compilations: { name: 'compilations', version: '0.1.0' },

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dad1500d8c1727b77632f984a693baacfb2375d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Fjalapeno 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Mhurd 
Gerrit-Reviewer: Ppchelko 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to e290b17

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397704 )

Change subject: Update mobileapps to e290b17
..

Update mobileapps to e290b17

List of changes:
c86a701 Bump mobile-sections and definitions version
bd943b9 Revert "Bump mobile-sections and definitions version"
e290b17 Summary: Send empty extracts, not 204, for main pages
xxx Update node module dependencies

Change-Id: I296b93088d37539cb1f324c646cd1bfecd9d97af
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/04/397704/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index a0db53e..c5708f1 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "9bc228c0234d93a62c28507ff478513ad418406e",
+  "_shasum": "5f5c6d52ee716664bdd13227e8e69a6286e6a9d5",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index ce498dd..8d36901 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "a2047593ad901549f99030afbef69c3ce8c79ba2",
+  "_shasum": "2db7370d391b424b5fabb26adf9a19995dc530f1",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 61ca333..e290b17 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 61ca33362ad188c262b965f31b7b8b07cd6bfe28
+Subproject commit e290b179a34d996cf5bbcee714a71d5d85a27d07

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I296b93088d37539cb1f324c646cd1bfecd9d97af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Bump mobile-sections and definitions version"

2017-12-11 Thread Mholloway (Code Review)
Hello BearND, Fjalapeno, Ppchelko, Mhurd, jenkins-bot, Jdlrobson,

I'd like you to do a code review.  Please visit

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

to review the following change.


Change subject: Revert "Bump mobile-sections and definitions version"
..

Revert "Bump mobile-sections and definitions version"

Reverting this for now in order to merge and deploy a quick fix.

This reverts commit c86a701a5247c1ff56866e06eb0207094c3035ea.

Change-Id: I9cbf36bab418e7ec3705ed62cf23b60f6d870ff7
---
M lib/mobile-util.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 3e9b515..acbccc8 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -10,11 +10,11 @@
 const NS_MAIN = 0;
 
 mUtil.CONTENT_TYPES = {
-mobileSections: { name: 'mobile-sections', version: '0.13.1' },
+mobileSections: { name: 'mobile-sections', version: '0.13.0' },
 media: { name: 'Media', version: '1.0.0' },
 readHtml: { name: 'ReadHtml', version: '0.1.0' },
 summary: { name: 'Summary', version: '1.3.0' },
-definition: { name: 'definition', version: '0.7.3' },
+definition: { name: 'definition', version: '0.7.2' },
 random: { name: 'random', version: '0.6.0' },
 announcements: { name: 'announcements', version: '0.1.0' },
 compilations: { name: 'compilations', version: '0.1.0' },

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cbf36bab418e7ec3705ed62cf23b60f6d870ff7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Fjalapeno 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Mhurd 
Gerrit-Reviewer: Ppchelko 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to c86a701

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397645 )

Change subject: Update mobileapps to c86a701
..

Update mobileapps to c86a701

List of changes:
c86a701 Bump mobile-sections and definitions version
xxx Update node module dependencies

Change-Id: Ie6c1881cfac1b55f505ab7f55d168a55afcd9888
---
M node_modules/kad/package.json
M node_modules/swagger-ui/package.json
M src
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/45/397645/1

diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json
index a0db53e..2e41c94 100644
--- a/node_modules/kad/package.json
+++ b/node_modules/kad/package.json
@@ -49,7 +49,7 @@
 "/limitation"
   ],
   "_resolved": 
"git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17;,
-  "_shasum": "9bc228c0234d93a62c28507ff478513ad418406e",
+  "_shasum": "74f84a21c52d7b40f4020fb23568fcf07cda23b2",
   "_shrinkwrap": null,
   "_spec": "kad@git+https://github.com/gwicke/kad.git#master;,
   "_where": "/opt/service/node_modules/limitation",
diff --git a/node_modules/swagger-ui/package.json 
b/node_modules/swagger-ui/package.json
index ce498dd..46c83cf 100644
--- a/node_modules/swagger-ui/package.json
+++ b/node_modules/swagger-ui/package.json
@@ -49,7 +49,7 @@
 "/"
   ],
   "_resolved": 
"git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541;,
-  "_shasum": "a2047593ad901549f99030afbef69c3ce8c79ba2",
+  "_shasum": "ba9cb22f433d759ecfb00496c6cf98ab360e8ea0",
   "_shrinkwrap": null,
   "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master;,
   "_where": "/opt/service",
diff --git a/src b/src
index 61ca333..c86a701 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 61ca33362ad188c262b965f31b7b8b07cd6bfe28
+Subproject commit c86a701a5247c1ff56866e06eb0207094c3035ea

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6c1881cfac1b55f505ab7f55d168a55afcd9888
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 61ca333

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397630 )

Change subject: Update mobileapps to 61ca333
..

Update mobileapps to 61ca333

List of changes:
7f8c06b Summary: fix geo coordinates
ac52f11 Media: Remove unwanted selectors from the blacklist
c2643d1 Media: Add section ID numbers
4f33a1c Dev: bring back Sepia request caching
40a2d00 Hygiene: Fix lint errors
6303c15 Stop suppressing RESTBase redirect handling when requesting HTML
34027e8 Hygiene: Update diff results to fix tests
05cf856 Revert "Update: exclude Canada from iOS countries list"
437b22c Hygiene: Fix README section on sepia HTTP recording
2716ab6 Summary: Send empty extracts (not 204) for an empty page
61ca333 Change reference endpoint to return structured reference sections
xxx Update node module dependencies

Change-Id: I8bc249568a123babcc27f029ae959fcfcd6dbeaa
---
M node_modules/core-js/bower.json
M node_modules/core-js/client/core.js
M node_modules/core-js/client/core.min.js
M node_modules/core-js/client/core.min.js.map
M node_modules/core-js/client/library.js
M node_modules/core-js/client/library.min.js
M node_modules/core-js/client/library.min.js.map
M node_modules/core-js/client/shim.js
M node_modules/core-js/client/shim.min.js
M node_modules/core-js/client/shim.min.js.map
M node_modules/core-js/library/modules/_core.js
M node_modules/core-js/library/modules/_iter-define.js
M node_modules/core-js/library/modules/_microtask.js
M node_modules/core-js/library/modules/_partial.js
M node_modules/core-js/library/modules/_set-collection-of.js
M node_modules/core-js/library/modules/_typed-buffer.js
A node_modules/core-js/library/modules/_user-agent.js
M node_modules/core-js/library/modules/es6.array.slice.js
M node_modules/core-js/library/modules/es6.promise.js
M node_modules/core-js/library/modules/es6.symbol.js
M node_modules/core-js/library/modules/es7.observable.js
M node_modules/core-js/library/modules/es7.string.pad-end.js
M node_modules/core-js/library/modules/es7.string.pad-start.js
M node_modules/core-js/library/modules/web.timers.js
M node_modules/core-js/library/stage/2.js
M node_modules/core-js/modules/_core.js
M node_modules/core-js/modules/_iter-define.js
M node_modules/core-js/modules/_microtask.js
M node_modules/core-js/modules/_partial.js
M node_modules/core-js/modules/_set-collection-of.js
M node_modules/core-js/modules/_typed-buffer.js
A node_modules/core-js/modules/_user-agent.js
M node_modules/core-js/modules/es6.array.slice.js
M node_modules/core-js/modules/es6.promise.js
M node_modules/core-js/modules/es6.symbol.js
M node_modules/core-js/modules/es7.observable.js
M node_modules/core-js/modules/es7.string.pad-end.js
M node_modules/core-js/modules/es7.string.pad-start.js
M node_modules/core-js/modules/web.timers.js
M node_modules/core-js/package.json
M node_modules/core-js/stage/2.js
M node_modules/kad/package.json
M node_modules/moment/min/moment-with-locales.js
M node_modules/moment/min/moment-with-locales.min.js
M node_modules/moment/min/moment.min.js
M node_modules/moment/moment.d.ts
M node_modules/moment/moment.js
M node_modules/moment/package.json
M node_modules/moment/src/lib/create/from-array.js
M node_modules/moment/src/lib/units/day-of-month.js
M node_modules/moment/src/moment.js
M node_modules/swagger-ui/package.json
M src
53 files changed, 1,409 insertions(+), 1,377 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps/deploy 
refs/changes/30/397630/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bc249568a123babcc27f029ae959fcfcd6dbeaa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps/deploy
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Don't return 204 for main pages

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397622 )

Change subject: Don't return 204 for main pages
..

Don't return 204 for main pages

I believe this was added based on a misreading of the earlier patch for
handling redirects.  Instead, main pages should be handled in the general
case of pages with no lead intros, which is to return a valid summary
object with empty extract fields.

This is subject to confirmation from Reading Web but I'm putting in the
patch now since it's nearly deployment time.

Bug: T177431
Change-Id: I3b5448369bd07580842188305d2c246b9f78b111
---
M lib/mobile-util.js
1 file changed, 0 insertions(+), 5 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index acbccc8..91649f7 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -200,7 +200,6 @@
 const meta = pageData.meta;
 const isContentModelWikitext = meta.contentmodel === 'wikitext';
 const isWhiteListedNamespace = 
mUtil.SUMMARY_NS_WHITELIST.includes(meta.ns);
-const isMainPage = meta.mainpage;
 const isRedirect = meta.redirect;
 
 if (!isContentModelWikitext) {
@@ -208,10 +207,6 @@
 }
 
 if (!isWhiteListedNamespace) {
-return { code: 204 };
-}
-
-if (isMainPage) {
 return { code: 204 };
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b5448369bd07580842188305d2c246b9f78b111
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Summary: Send empty summary (not 204) for empty page

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397566 )

Change subject: Summary: Send empty summary (not 204) for empty page
..

Summary: Send empty summary (not 204) for empty page

Bug: T182596
Change-Id: I2331096519ceb95eef6c9d7013b80ab026082ff4
---
M lib/mobile-util.js
M test/features/summary/pagecontent.js
2 files changed, 12 insertions(+), 9 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index d0bea4e..acbccc8 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -196,7 +196,6 @@
  * @return {!Object} a summary 2.0 spec-compliant page summary object
  */
 mUtil.buildSummary = function(domain, title, pageData, disambiguation = false) 
{
-let summary = {};
 const page = pageData.page;
 const meta = pageData.meta;
 const isContentModelWikitext = meta.contentmodel === 'wikitext';
@@ -222,15 +221,8 @@
 
 const leadText = domino.createDocument(page.sections[0].text);
 const intro = transforms.extractLeadIntroduction(leadText);
+const summary = intro.length ? transforms.summarize(intro) : intro;
 
-if (intro) {
-summary = transforms.summarize(intro);
-} else {
-// If the lead introduction is empty we should consider it
-// a placeholder e.g. redirect page. To avoid sending an empty
-// summary 204. (T176517)
-return { code: 204 };
-}
 return Object.assign({
 code: 200,
 type : disambiguation ? 'disambiguation' : 'standard',
diff --git a/test/features/summary/pagecontent.js 
b/test/features/summary/pagecontent.js
index 5680597..7b768f7 100644
--- a/test/features/summary/pagecontent.js
+++ b/test/features/summary/pagecontent.js
@@ -34,4 +34,15 @@
 assert.ok(res.body.extract_html.indexOf('foobar') > -1);
 });
 });
+
+it('empty summary (not 204) should be sent for empty page', () => {
+const uri = localUri('PreviewsEmpty%2Fsandbox', 
'en.wikipedia.beta.wmflabs.org');
+return preq.get({ uri })
+.then((res) => {
+assert.deepEqual(res.status, 200);
+assert.deepEqual(res.body.type, 'standard');
+assert.deepEqual(res.body.extract, '', 'should send empty 
plaintext extract');
+assert.deepEqual(res.body.extract_html, '', 'should send empty 
html extract');
+});
+});
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2331096519ceb95eef6c9d7013b80ab026082ff4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Update diff results to fix tests

2017-12-11 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397551 )

Change subject: Hygiene: Update diff results to fix tests
..

Hygiene: Update diff results to fix tests

Change-Id: Ie4eef3ebdfbcf91171761671c4025add3e659554
---
M 
test/diff/results/page_formatted-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
M test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
M 
test/diff/results/page_mobile-sections-enwiki-User%3ABSitzmann_(WMF)_MCS_Test_Frankenstein.json
3 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
index c494a6c..3b0453e 100644
--- 
"a/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
+++ 
"b/test/diff/results/page_formatted-enwiki-User%3ABSitzmann_\050WMF\051_MCS_Test_Frankenstein.json"
@@ -145,7 +145,7 @@
   },
   {
 "id": 18,
-"text": " \nWhen a section is a summary of another article 
that provides a full exposition of the section, a link to that article should 
appear immediately under the section heading. You can use the {{Main}} template to 
generate a \"Main article\" link.\n\nIf one or more articles 
provide further information or additional details (rather than a full 
exposition, see above), references to such articles may be placed immediately 
after the section heading for that section, provided this does not duplicate a 
wikilink in the text. These additional references should be grouped along with 
the {{Main}} template (if there is one), or at the 
foot of the section that introduces the material for which these templates 
provide additional information. You can use one of the following templates to 
generate these links:\n {{Details}}–
  this generates a \"For more details on this topic, see\" 
link\n {{Further}}–
  this generates a \"Further information\" link\n 
{{See 
also}}–  this generates 
a \"See also\" link\n\nFor example, to generate a \"See 
also\" link to the article on Wikipedia:How to 
edit a page, type {{See 
also|Wikipedia:How to edit a page}}, which will 
generate: See also: Wikipedia:How to edit a page\n\n",
+"text": " \nWhen a section is a summary of another article 
that provides a full exposition of the section, a link to that article should 
appear immediately under the section heading. You can use the {{Main}} template to 
generate a \"Main article\" link.\n\nIf one or more articles 
provide further information or additional details (rather than a full 
exposition, see above), references to such articles may be placed immediately 
after the section heading for that section, provided this does not duplicate a 
wikilink in the text. These additional references should be grouped along with 
the {{Main}} template (if there is one), or at the 
foot of the section that introduces the material for which these templates 
provide additional information. You can use one of the following templates to 
generate these links:\n {{Details}}–
  this generates a \"For more details on this topic, see\" 
link\n {{Further}}–
  this generates a \"Further information\" link\n 
{{See 
also}}–  this generates 
a \"See also\" link\n\nFor example, to generate a \"See 
also\" link to the article on Wikipedia:How to 
edit a page, type {{See 
also|Wikipedia:How to edit a page}}, which will 
generate: See also: Wikipedia:How to edit a page\n\n",
 "toclevel": 3,
 "line": "Section templates and summary style",
 "anchor": "Section_templates_and_summary_style"
diff --git a/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json 
b/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
index a2eca8a..da5c27d 100644
--- a/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
+++ b/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
@@ -90,7 +90,7 @@
 {
   "type": "image",
   "caption": {
-"html": "\"Cassovia: Superioris Hungariae Civitas Primaria\",[12] the prospect from Civitates orbis terrarum. 
Cassovia (Slovak: Košice, German: Kaschau, Hungarian: 
Kassa), the \"capital\" of Upper Hungary in 1617.",
+"html": "\"Cassovia: Superioris Hungariae Civitas Primaria\",[12] the prospect from Civitates orbis terrarum. 
Cassovia (Slovak: Košice, German: Kaschau, Hungarian: 
Kassa), the \"capital\" of Upper Hungary in 1617.",
 "text": "\"Cassovia: Superioris Hungariae Civitas Primaria\",[12] the 
prospect from Civitates orbis terrarum. Cassovia (Slovak: Košice, German: 
Kaschau, Hungarian: Kassa), the \"capital\" of Upper Hungary in 1617."
   },
   "titles": {
diff --git 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Update: exclude Canada from iOS countries list"

2017-12-11 Thread Mholloway (Code Review)
Hello Gergő Tisza, BearND, Fjalapeno, Ppchelko, Mhurd, jenkins-bot, Jdlrobson,

I'd like you to do a code review.  Please visit

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

to review the following change.


Change subject: Revert "Update: exclude Canada from iOS countries list"
..

Revert "Update: exclude Canada from iOS countries list"

This reverts commit 4317ea51751104ec8898a6f9f53c5bd06a970cd6.

Change-Id: Ibcea894d8154d378354541408882cb724bcde955
---
M etc/feed/announcements.js
M lib/feed/announcements.js
M test/lib/feed/announcements.js
3 files changed, 11 insertions(+), 44 deletions(-)


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

diff --git a/etc/feed/announcements.js b/etc/feed/announcements.js
index c5c436c..dbe1743 100644
--- a/etc/feed/announcements.js
+++ b/etc/feed/announcements.js
@@ -20,7 +20,7 @@
 const disclaimerHtml
 = 'By submitting, you are agreeing to our https://wikimediafoundation.org/wiki/Donor_policy/en;>donor privacy 
policy.';
 
-const androidCountryVariants = [ {
+const countryVariants = [ {
 countryCode: 'US',
 country: 'the U.S.',
 currency: '$',
@@ -41,38 +41,6 @@
 }, {
 countryCode: 'CA',
 country: 'Canada',
-currency: '$',
-average: 15,
-coffee: 3
-}, {
-countryCode: 'NZ',
-country: 'New Zealand',
-currency: '$',
-average: 15,
-coffee: 3
-}, {
-countryCode: 'IE',
-country: 'Ireland',
-currency: '€',
-average: 10,
-coffee: 2
-}];
-
-const iOSCountryVariants = [ {
-countryCode: 'US',
-country: 'the U.S.',
-currency: '$',
-average: 15,
-coffee: 3
-}, {
-countryCode: 'GB',
-country: 'the UK',
-currency: '£',
-average: 10,
-coffee: 2
-}, {
-countryCode: 'AU',
-country: 'Australia',
 currency: '$',
 average: 15,
 coffee: 3
@@ -116,7 +84,6 @@
 // imageUrl,
 buttonLabel,
 disclaimerHtml,
-androidCountryVariants,
-iOSCountryVariants,
+countryVariants,
 buildBaseBodyText
 };
diff --git a/lib/feed/announcements.js b/lib/feed/announcements.js
index 14f0deb..08fb116 100644
--- a/lib/feed/announcements.js
+++ b/lib/feed/announcements.js
@@ -66,10 +66,10 @@
 };
 
 function getActiveAnnouncements() {
-const res = [];
-config.androidCountryVariants.forEach(variant => 
res.push(buildAndroidAnnouncement(variant)));
-config.iOSCountryVariants.forEach(variant => 
res.push(buildIosAnnouncement(variant)));
-return res;
+const results = [];
+config.countryVariants.forEach(variant => 
results.push(buildAndroidAnnouncement(variant)));
+config.countryVariants.forEach(variant => 
results.push(buildIosAnnouncement(variant)));
+return results;
 }
 
 function isActiveWiki(domain) {
diff --git a/test/lib/feed/announcements.js b/test/lib/feed/announcements.js
index d235957..2a5019f 100644
--- a/test/lib/feed/announcements.js
+++ b/test/lib/feed/announcements.js
@@ -16,7 +16,7 @@
 
 it('should return some announcements for active wiki', () => {
 const res = mut.getAnnouncements(activeAnnouncementDomain);
-assert.ok(res.announce.length === 11);
+assert.ok(res.announce.length === 12);
 assert.equal(res.announce[0].id, 'EN1217FUNDRAISINGANDROIDUS');
 assert.equal(res.announce[1].id, 'EN1217FUNDRAISINGANDROIDGB');
 assert.equal(res.announce[2].id, 'EN1217FUNDRAISINGANDROIDAU');
@@ -41,7 +41,7 @@
 const doc = domino.createDocument();
 // destructure 'id', 'text' and 'action.title' from the iOS 
announcement
 const { text, action: { title } }
-= mut.testing.buildIosAnnouncement(config.iOSCountryVariants[0]);
+= mut.testing.buildIosAnnouncement(config.countryVariants[0]);
 const fieldsToCheck = { text, title };
 for (const textOnlyFieldName of Object.keys(fieldsToCheck)) {
 const textToCheck = fieldsToCheck[textOnlyFieldName];
@@ -58,7 +58,7 @@
 
 it('should deliver HTML in certain Android announcements fields', () => {
 const doc = domino.createDocument();
-const { text } = 
mut.testing.buildAndroidAnnouncement(config.androidCountryVariants[0]);
+const { text } = 
mut.testing.buildAndroidAnnouncement(config.countryVariants[0]);
 const fieldsToCheck = { text };
 for (const textOnlyFieldName of Object.keys(fieldsToCheck)) {
 const textToCheck = fieldsToCheck[textOnlyFieldName];
@@ -74,13 +74,13 @@
 });
 
 it('caption_HTML on iOS should be inside a paragraph', () => {
-const { caption_HTML } = 
mut.testing.buildIosAnnouncement(config.iOSCountryVariants[0]);
+const { caption_HTML } = 
mut.testing.buildIosAnnouncement(config.countryVariants[0]);
 const doc = domino.createDocument(caption_HTML);
 assert.deepEqual(doc.body.firstElementChild.tagName, 'P');
 });
 
 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Fix lint errors

2017-12-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396544 )

Change subject: Hygiene: Fix lint errors
..

Hygiene: Fix lint errors

The linter is now complaining about camel-casing on these two lines. We
probably shouldn't change the property at this point, so let's just ignore
the rule on a per-line basis.

Change-Id: I3b51a304fda252495de73d52918249003f99a4f8
---
M test/lib/feed/announcements.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/test/lib/feed/announcements.js b/test/lib/feed/announcements.js
index d235957..4b4e968 100644
--- a/test/lib/feed/announcements.js
+++ b/test/lib/feed/announcements.js
@@ -74,13 +74,13 @@
 });
 
 it('caption_HTML on iOS should be inside a paragraph', () => {
-const { caption_HTML } = 
mut.testing.buildIosAnnouncement(config.iOSCountryVariants[0]);
+const { caption_HTML } = 
mut.testing.buildIosAnnouncement(config.iOSCountryVariants[0]); // 
eslint-disable-line max-len,camelcase
 const doc = domino.createDocument(caption_HTML);
 assert.deepEqual(doc.body.firstElementChild.tagName, 'P');
 });
 
 it('caption_HTML on Android should not be inside a paragraph', () => {
-const { caption_HTML } = 
mut.testing.buildAndroidAnnouncement(config.androidCountryVariants[0]); // 
eslint-disable-line max-len
+const { caption_HTML } = 
mut.testing.buildAndroidAnnouncement(config.androidCountryVariants[0]); // 
eslint-disable-line max-len,camelcase
 const doc = domino.createDocument(caption_HTML);
 assert.notDeepEqual(doc.body.firstElementChild.tagName, 'P');
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b51a304fda252495de73d52918249003f99a4f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...trending-edits[master]: Hygiene: Fix tests

2017-12-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396436 )

Change subject: Hygiene: Fix tests
..

Hygiene: Fix tests

This was failing due to a change in the scoring algorithm:

https://github.com/jdlrobson/wikipedia-edits-scorer/commit/dbc003a8fd260b4e3598b932406fe480a49721a7

Change-Id: I4625ae1e69d14f9e529fec178a36bd8a685dac05
---
M test/features/lib/score-pages.js
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/trending-edits 
refs/changes/36/396436/1

diff --git a/test/features/lib/score-pages.js b/test/features/lib/score-pages.js
index 74bc85f..3a6f3bf 100644
--- a/test/features/lib/score-pages.js
+++ b/test/features/lib/score-pages.js
@@ -8,9 +8,9 @@
 it('check scoring works', function() {
 var date = new Date( '2016-11-15T18:00:55+00:00' );
 var input = [
-  { bytes: 10, edits: 20, from: date, anonEdits: 0,
+  { bytes: 250, edits: 20, from: date, anonEdits: 0,
   contributors: { names: { a: 10, b: 10 }, total: 2 } },
-  { bytes: 10, edits: 20, from: date, anonEdits: 0,
+  { bytes: 250, edits: 20, from: date, anonEdits: 0,
   contributors: { names: { a: 5, b: 5, c: 5, d: 5 }, total: 4 } }
 ];
 var pages = scorePages(new Date(date.getTime() + 60 * 10),input);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4625ae1e69d14f9e529fec178a36bd8a685dac05
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/trending-edits
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...trending-edits[master]: Hygiene: Remove NSP workaround for moment.js

2017-12-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396433 )

Change subject: Hygiene: Remove NSP workaround for moment.js
..

Hygiene: Remove NSP workaround for moment.js

The fix for the moment.js ReDOS issue was released in 2.19.3.  The NSP
exception should be removed and node modules updated as needed.

Bug: T181445
Change-Id: I748c56f0b1b935edc3aca266e20dfb4b44ab8dab
---
D .nsprc
1 file changed, 0 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/trending-edits 
refs/changes/33/396433/1

diff --git a/.nsprc b/.nsprc
deleted file mode 100644
index 98b2ef4..000
--- a/.nsprc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "exceptions": [
-"https://nodesecurity.io/advisories/532;
-  ]
-}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I748c56f0b1b935edc3aca266e20dfb4b44ab8dab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/trending-edits
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Dev: Stop caching test HTTP responses by default

2017-12-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396425 )

Change subject: Dev: Stop caching test HTTP responses by default
..

Dev: Stop caching test HTTP responses by default

Let's leave it up to the developer to set this in an environment variable
if desired.

Change-Id: If3113027ff730ea6d1aa3398c869f197d5759e6e
---
M test/utils/server.js
1 file changed, 0 insertions(+), 8 deletions(-)


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

diff --git a/test/utils/server.js b/test/utils/server.js
index a1fb54f..f9d0127 100644
--- a/test/utils/server.js
+++ b/test/utils/server.js
@@ -1,14 +1,6 @@
 'use strict';
 
 
-// Default to recording+replaying http fixtures,
-// only if we are not running in Docker
-if (process.env.IN_DOCKER) {
-process.env.VCR_MODE = undefined;
-} else {
-process.env.VCR_MODE = process.env.VCR_MODE || 'cache';
-}
-
 const BBPromise = require('bluebird');
 const ServiceRunner = require('service-runner');
 const logStream = require('./logStream');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3113027ff730ea6d1aa3398c869f197d5759e6e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Remove unwanted selectors from the blacklist

2017-12-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396420 )

Change subject: Media: Remove unwanted selectors from the blacklist
..

Media: Remove unwanted selectors from the blacklist

We probably don't want these after all, per Gergo's comments on
https://gerrit.wikimedia.org/r/#/c/396031/.

This partially reverts that commit.

Bug: T177430
Change-Id: I54b5be4bc6acad2f8ad439f1ff2ad096df5d0def
---
M lib/selectors.js
M test/lib/media/media-test-inclusion.js
2 files changed, 2 insertions(+), 13 deletions(-)


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

diff --git a/lib/selectors.js b/lib/selectors.js
index 63c7b76..24a532c 100644
--- a/lib/selectors.js
+++ b/lib/selectors.js
@@ -17,10 +17,7 @@
 // MultimediaViewer.
 const MediaBlacklist = [
 '.metadata',
-'.noviewer',
-'.noarticletext',
-'#siteNotice',
-'ul.mw-gallery-slideshow li.gallerybox' // thumbnails of a slideshow 
gallery
+'.noviewer'
 ];
 
 const ImageSelectors = MediaSelectors.filter(selector => 
selector.includes('Image'));
diff --git a/test/lib/media/media-test-inclusion.js 
b/test/lib/media/media-test-inclusion.js
index c3df360..551ebe0 100644
--- a/test/lib/media/media-test-inclusion.js
+++ b/test/lib/media/media-test-inclusion.js
@@ -31,14 +31,6 @@
 
 const imageNoViewer = '';
 const imageMetadata = '';
-const imageNoArticleText = '';
-const imageSiteNotice = '';
-const imageSlideshowGallery =
-'' +
-'' +
-'' +
-'' +
-'';
 
 const images = [imageFigure, imageSpan, imageFigureInline, imageThumbFigure, 
imageThumbSpan, imageThumbFigureInline];
 const videos = [videoFigure, videoSpan, videoFigureInline, videoThumbFigure, 
videoThumbSpan, videoThumbFigureInline];
@@ -46,7 +38,7 @@
 const validItems = images.concat(videos).concat(audio);
 
 const noType = [noTypeFigure, noTypeSpan, noTypeFigureInline];
-const blacklisted = [imageNoViewer, imageMetadata, imageNoArticleText, 
imageSiteNotice, imageSlideshowGallery];
+const blacklisted = [imageNoViewer, imageMetadata];
 const invalidItems = noType.concat(blacklisted);
 
 describe('lib:media expected items are included or excluded', () => {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54b5be4bc6acad2f8ad439f1ff2ad096df5d0def
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Revert "Media: Update selector blacklist"

2017-12-08 Thread Mholloway (Code Review)
Hello Gergő Tisza, BearND, Fjalapeno, Ppchelko, Mhurd, jenkins-bot, Jdlrobson,

I'd like you to do a code review.  Please visit

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

to review the following change.


Change subject: Revert "Media: Update selector blacklist"
..

Revert "Media: Update selector blacklist"

Per comments from @Tgr.

This reverts commit 71f581c5d22c1707dc17d93a2b8ef0ca91e4a480.

Change-Id: Ibc97a615c80d401db7812b083c9d094ab6554fe9
---
M lib/selectors.js
D test/lib/media/media-test-inclusion.js
D test/lib/media/media-test-metadata.js
A test/lib/media/media-test.js
4 files changed, 133 insertions(+), 156 deletions(-)


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

diff --git a/lib/selectors.js b/lib/selectors.js
index 63c7b76..0aa87b9 100644
--- a/lib/selectors.js
+++ b/lib/selectors.js
@@ -13,14 +13,9 @@
 'span.IPA+small a[rel=mw:MediaLink]'
 ];
 
-// Exclusions for various categories of content. See MMVB.isAllowedThumb in 
mediawiki-extensions-
-// MultimediaViewer.
 const MediaBlacklist = [
-'.metadata',
 '.noviewer',
-'.noarticletext',
-'#siteNotice',
-'ul.mw-gallery-slideshow li.gallerybox' // thumbnails of a slideshow 
gallery
+'.metadata'
 ];
 
 const ImageSelectors = MediaSelectors.filter(selector => 
selector.includes('Image'));
diff --git a/test/lib/media/media-test-inclusion.js 
b/test/lib/media/media-test-inclusion.js
deleted file mode 100644
index c3df360..000
--- a/test/lib/media/media-test-inclusion.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* eslint-disable max-len */
-
-'use strict';
-
-const assert = require('../../utils/assert');
-const media = require('../../../lib/media');
-
-const imageFigure = '';
-const imageSpan = '';
-const imageFigureInline = '';
-
-const imageThumbFigure = '';
-const imageThumbSpan = '';
-const imageThumbFigureInline = '';
-
-const videoFigure = '';
-const videoSpan = '';
-const videoFigureInline = '';
-
-const videoThumbFigure = '';
-const videoThumbSpan = '';
-const videoThumbFigureInline = '';
-
-const audioFigure = '';
-const audioSpan = '';
-const audioFigureInline = '';
-
-const noTypeFigure = '';
-const noTypeSpan = '';
-const noTypeFigureInline = '';
-
-const imageNoViewer = '';
-const imageMetadata = '';
-const imageNoArticleText = '';
-const imageSiteNotice = '';
-const imageSlideshowGallery =
-'' +
-'' +
-'' +
-'' +
-'';
-
-const images = [imageFigure, imageSpan, imageFigureInline, imageThumbFigure, 
imageThumbSpan, imageThumbFigureInline];
-const videos = [videoFigure, videoSpan, videoFigureInline, videoThumbFigure, 
videoThumbSpan, videoThumbFigureInline];
-const audio = [audioFigure, audioSpan, audioFigureInline];
-const validItems = images.concat(videos).concat(audio);
-
-const noType = [noTypeFigure, noTypeSpan, noTypeFigureInline];
-const blacklisted = [imageNoViewer, imageMetadata, imageNoArticleText, 
imageSiteNotice, imageSlideshowGallery];
-const invalidItems = noType.concat(blacklisted);
-
-describe('lib:media expected items are included or excluded', () => {
-
-it('items should be found for expected selectors', () => {
-const page = validItems.join('');
-const result = media.getMediaItemInfoFromPage(page);
-assert.deepEqual(result.length, validItems.length);
-assert.deepEqual(result.filter(i => i.title === 'File:Foo').length, 
validItems.length);
-assert.deepEqual(result.filter(i => i.type === 
media.Image.name).length, images.length);
-assert.deepEqual(result.filter(i => i.type === 
media.Video.name).length, videos.length);
-assert.deepEqual(result.filter(i => i.type === 
media.Audio.name).length, audio.length);
-});
-
-it('items should not be found for other selectors', () => {
-const page = invalidItems.join('');
-const result = media.getMediaItemInfoFromPage(page);
-assert.deepEqual(result.length, 0);
-});
-
-});
diff --git a/test/lib/media/media-test-metadata.js 
b/test/lib/media/media-test-metadata.js
deleted file mode 100644
index d472a2c..000
--- a/test/lib/media/media-test-metadata.js
+++ /dev/null
@@ -1,80 +0,0 @@
-'use strict';
-
-const assert = require('../../utils/assert');
-const media = require('../../../lib/media');
-
-const imageWithCaption =
-'' +
-'' +
-'An example image' +
-'';
-
-const videoWithMetadata =
-'' +
-'' +
-'';
-
-const videoWithDerivative =
-'' +
-'' +
-'https://example.com/Foo.ogv;' +
-   ' type=\'video/ogg; codecs="theora, vorbis"\'' +
-   ' data-title="Foo"' +
-   ' data-shorttitle="Foo"' +
-   ' data-file-width="120"' +
-   ' data-file-height="120"' +
-'/>' +
-'' +
-'';
-
-const spokenWikipedia =
-'' +
-'' +
-'';
-
-const 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Fix README section on sepia HTTP recording

2017-12-08 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396409 )

Change subject: Hygiene: Fix README section on sepia HTTP recording
..

Hygiene: Fix README section on sepia HTTP recording

This was a bit garbled.

Change-Id: I0910521fb9086dffcdeed1d93c261e6eecc78e0c
---
M README.md
1 file changed, 15 insertions(+), 22 deletions(-)


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

diff --git a/README.md b/README.md
index c20c8fa..c203728 100644
--- a/README.md
+++ b/README.md
@@ -109,32 +109,25 @@
 is an important aspect of service development, there is also a bundled tool
 reporting the percentage of code covered. Start it with:
 
-After the first run http interactions should be cached in the `fixtures/`
-folder. If you re-run the tests, they should use the cached fixtures and run
-faster (and offline).
-
-For getting fresh fixtures just remove the `fixtures` folder and re-run the
-tests.
-
-Here are some other options regarding http caching:
-
-```
-npm test # Run tests with cached http interactions (same as VCR_MODE=cache),
-caches new requests. Should be a lot faster, also VCR_MODE=playback plays using
-cached http interactions but goes to network for uncached ones (without caching
-them).
-VCR_MODE=record npm test # Run tests recording http interactions
-```
-
-See [sepia](https://www.npmjs.com/package/sepia) for more documentation about
-the http recording.
-
 ```
 npm run-script coverage
 ```
 
-If you're going to run the tests many times, you can record the external HTTP
-interactions for running the tests faster:
+ HTTP Recording
+
+You can take advantage of HTTP request recording provided by the sepia library 
to make running the tests much faster.
+
+To record requests made other than to the service itself, run:
+
+```
+VCR_MODE=record npm test
+```
+
+After running the tests with `VCR_MODE=record`, http interactions should be 
cached in the `fixtures/` folder. If you re-run the tests, they should use the 
cached fixtures and run faster.
+
+For getting fresh fixtures just remove the `fixtures` folder and re-run the 
tests.
+
+See [sepia](https://www.npmjs.com/package/sepia) for more documentation.
 
 ### Troubleshooting
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0910521fb9086dffcdeed1d93c261e6eecc78e0c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Summary: fix geo coordinates

2017-12-07 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396095 )

Change subject: Summary: fix geo coordinates
..

Summary: fix geo coordinates

There were always coming back empty since we were looking for the wrong
keys in the MW API metadata response. Not sure how this regressed.

Updated the spec examples to include an example with coordinates.

Change-Id: If36017dffb8212f3537c5a27e6dba2c520911138
---
M lib/mobile-util.js
M spec.yaml
2 files changed, 8 insertions(+), 5 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 46a6c66..f32c1ab 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -243,9 +243,9 @@
 timestamp: meta.lastmodified,
 description: meta.description,
 coordinates: meta.geo && {
-lat: meta.geo.lat,
-lon: meta.geo.lon
-},
+lat: meta.geo.latitude,
+lon: meta.geo.longitude
+} || undefined,
 content_urls: mUtil.buildContentUrls(domain, title, meta),
 api_urls: mUtil.buildApiUrls(domain, title, meta),
 }, summary);
diff --git a/spec.yaml b/spec.yaml
index ed54015..8f13170 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -667,11 +667,11 @@
   schema:
 $ref: '#/definitions/problem'
   x-amples:
-- title: Get summary for Barack Obama
+- title: Get summary for Manitowoc, Wisconsin
   request:
 params:
   domain: en.wikipedia.org
-  title: Barack_Obama
+  title: Manitowoc,_Wisconsin
   response:
 status: 200
 headers:
@@ -702,6 +702,9 @@
   revision: /.+/
   tid: /.+/
   timestamp: /.+/
+  coordinates:
+lat: /.+/
+lon: /.+/
   description: /.+/
   content_urls:
 desktop:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If36017dffb8212f3537c5a27e6dba2c520911138
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Add section numbers

2017-12-07 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396085 )

Change subject: Media: Add section numbers
..

Media: Add section numbers

Note: This depends on a Parsoid change adding section numbering that is
not yet deployed.  For now it will need to be tested against a local
Parsoid instance.

The diff tests will fail until the change is deployed to production.

Bug: T177430
Change-Id: If5424111a2d062550f910a1bee70f55b8a412a0d
---
M lib/media.js
M test/diff/results/page_media-enwiki-Hummingbird.json
M test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
M test/lib/media/media-test-metadata.js
4 files changed, 104 insertions(+), 12 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index 6e6f81b..cd46826 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -64,6 +64,7 @@
 html: figCaption.innerHTML,
 text: figCaption.textContent
 };
+const section = 
parseInt(elem.closest('section').getAttribute('data-mw-section-id'), 10);
 let title = resource && 
resource.getAttribute('resource').replace(/^.\//, '');
 let startTime;
 let endTime;
@@ -100,6 +101,7 @@
 }
 return {
 title,
+section,
 type: mediaType.name,
 caption,
 start_time: startTime,
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index e3a50d5..6a952ef 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -1,6 +1,7 @@
 {
   "items": [
 {
+  "section": 0,
   "type": "image",
   "titles": {
 "canonical": "File:Trinidad_and_Tobago_hummingbirds_composite.jpg",
@@ -27,9 +28,10 @@
   "description": "Trinidad and Tobago hummingbirds. Composite of birds 
from Trinidad and TobagoBlue-chinned sapphire (Chlorestes notata notata) male, 
TrindadRuby-topaz hummingbird (Chrysolampis mosquitus) male, 
Tobago\nWhite-chested emerald (Amazilia brevirostris), 
Trinidad\nWhite-necked jacobin (Florisuga mellivora mellivora) male 
Trinidad"
 },
 {
+  "section": 3,
   "type": "image",
   "caption": {
-"html": "Purple-throated carib feeding 
at a flower",
+"html": "Purple-throated carib 
feeding at a flower",
 "text": "Purple-throated carib feeding at a flower"
   },
   "titles": {
@@ -57,9 +59,10 @@
   "description": "Purple-throated Carib hummingbird (Eulampis 
jugularis) feeding photographed in its natural habitat in the Morne 
Diablotins National Park in Dominica. Guide was local expert 'Dr Birdy' 
Bertrand Baptiste."
 },
 {
+  "section": 5,
   "type": "image",
   "caption": {
-"html": "A color plate illustration from Ernst 
Haeckel's Kunstformen der Natur (1899), showing a variety of 
hummingbirds",
+"html": "A color plate illustration from Ernst Haeckel's Kunstformen der 
Natur (1899), showing a variety of hummingbirds",
 "text": "A color plate illustration from Ernst Haeckel's Kunstformen 
der Natur (1899), showing a variety of hummingbirds"
   },
   "titles": {
@@ -86,6 +89,7 @@
   "description": "English: Hummingbirds (drawn from millinery 
specimens, body positions are not natural)\nMale https://en.wikipedia.org/wiki/Ruby-throated_Hummingbird\; 
class=\"extiw\" title=\"en:Ruby-throated Hummingbird\">Ruby-throated 
Hummingbird\n\nMale https://en.wikipedia.org/wiki/Horned_Sungem\; class=\"extiw\" 
title=\"en:Horned Sungem\">Horned Sungem\n\nMale https://en.wikipedia.org/wiki/Crimson_Topaz\; class=\"extiw\" 
title=\"en:Crimson Topaz\">Crimson Topaz\n\nMale https://en.wikipedia.org/wiki/Red-tailed_Comet\; class=\"extiw\" 
title=\"en:Red-tailed Comet\">Red-tailed Comet\n\nMale https://en.wikipedia.org/wiki/Tufted_Coquette\; class=\"extiw\" 
title=\"en:Tufted Coquette\">Tufted Coquette\n\nMale https://en.wikipedia.org/wiki/Sword-billed_Hummingbird\; class=\"extiw\" 
title=\"en:Sword-billed Hummingbird\">Sword-billed 
Hummingbird\n\nhttps://en.wikipedia.org/wiki/Buff-tailed_Sicklebill\; class=\"extiw\" 
title=\"en:Buff-tailed Sicklebill\">Buff-tailed Sicklebill\nMale 
https://en.wikipedia.org/wiki/Dot-eared_Coquette\; class=\"extiw\" 
title=\"en:Dot-eared Coquette\">Dot-eared Coquette\n\nMale https://en.wikipedia.org/wiki/White-vented_Violetear\; class=\"extiw\" 
title=\"en:White-vented Violetear\">White-vented Violetear\n\nMale 
https://en.wikipedia.org/wiki/Hooded_Visorbearer\; class=\"extiw\" 
title=\"en:Hooded Visorbearer\">Hooded Visorbearer\n\nFemale https://en.wikipedia.org/wiki/Juan_Fern%C3%A1ndez_Firecrown\; 
class=\"extiw\" title=\"en:Juan Fernández Firecrown\">Juan Fernández 
Firecrown\n\nMale https://en.wikipedia.org/wiki/Booted_Racket-tail\; 

[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to 71f581c

2017-12-07 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396068 )

Change subject: Update mobileapps to 71f581c
..

Update mobileapps to 71f581c

List of changes:
4f0d18e tag-deploy: push only the created tag
f8ef398 Batch MW API query requests
dc44d64 Get derivatives from Parsoid HTML and call imageinfo for metadata
48255b0 Add diff test for the media endpoint
621b41d Add audio files to response
9788357 Add on-wiki captions to media response
fbf06a2 Add thumb_mime and duration to media output
0d5db1c Media: move extmetadata properties of interest into the top level
19f078f Report image properties in standard image objects
969e277 Media: Add thumb_time to video items, if it exists
c346c71 Hygiene: Remove NSP workaround for moment.js
9a896c2 Media: Mark spoken WP files with audio_type: spoken
0e94a9e Media: exclude 'width' and 'height' properties from audio items
c9f0480 Hygiene: Add media selector unit tests
f247cd5 Media: Unit testing for metadata and derivatives parsing
fb876d1 Media: Add pronunciation audio files
abd03a8 Hygiene: Fix fixVideoAnchor test
71fde87 Hygiene: Consolidate media selectors
cdda9f6 Fix: restore video derivatives
764f838 Hygiene: remove adjustMemberKeys and fillInMemberKeys from mobile-util
b7c51da Dev: Lint on pre-commit, not when running unit tests
f14174d Fix broken tests
bbaa87b Media endpoint output tweaks, pt. 1
d30f725 Media endpoint output tweaks, pt. 2: derivatives
1c6e047 Media: Add page count for paged items (PDF, TIFF, DjVu, etc.)
d9b7665 Media: Exclude .noviewer and .metadata items
c49685a Hygiene: Use Element.closest where appropriate
ee50d59 Version number for the media endpoint
1bfee40 Fix ruwiki news template
db77bd2 Summary 2.0: Mark disambiguation pages
47b3dac Hygiene: Handle long lines in news-sites.js consistently
71f581c Media: Update selector blacklist
xxx Update node module dependencies

Change-Id: Ice7c739af87951bf7b90b584fec13af177ac57d9
---
M node_modules/abbrev/LICENSE
M node_modules/abbrev/package.json
M node_modules/ajv/dist/ajv.bundle.js
M node_modules/ajv/dist/ajv.min.js
M node_modules/ajv/dist/ajv.min.js.map
M node_modules/ajv/dist/nodent.min.js
M node_modules/ajv/dist/regenerator.min.js
M node_modules/ajv/lib/ajv.js
M node_modules/ajv/package.json
M node_modules/aproba/index.js
M node_modules/aproba/package.json
A node_modules/are-we-there-yet/CHANGES.md~
M node_modules/are-we-there-yet/package.json
M node_modules/block-stream/package.json
A node_modules/console-control-strings/README.md~
M node_modules/console-control-strings/package.json
M node_modules/cryptiles/.npmignore
M node_modules/deep-extend/package.json
M node_modules/delegates/package.json
M node_modules/esprima/dist/esprima.js
M node_modules/fs.realpath/package.json
M node_modules/fstream-ignore/package.json
M node_modules/fstream/package.json
M node_modules/gauge/package.json
M node_modules/gc-stats/.travis.yml
M node_modules/gc-stats/appveyor.yml
D 
node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v48-linux-x64/gcstats.node
A 
node_modules/gc-stats/build/gcstats/v1.1.0/Release/node-v48-linux-x64/gcstats.node
D node_modules/gc-stats/node_modules/.bin/mkdirp
D node_modules/gc-stats/node_modules/.bin/uuid
D node_modules/gc-stats/node_modules/ajv/.tonic_example.js
D node_modules/gc-stats/node_modules/ajv/LICENSE
D node_modules/gc-stats/node_modules/ajv/dist/ajv.bundle.js
D node_modules/gc-stats/node_modules/ajv/dist/ajv.min.js
D node_modules/gc-stats/node_modules/ajv/dist/ajv.min.js.map
D node_modules/gc-stats/node_modules/ajv/dist/nodent.min.js
D node_modules/gc-stats/node_modules/ajv/dist/regenerator.min.js
D node_modules/gc-stats/node_modules/ajv/lib/ajv.d.ts
D node_modules/gc-stats/node_modules/ajv/lib/ajv.js
D node_modules/gc-stats/node_modules/ajv/lib/async.js
D node_modules/gc-stats/node_modules/ajv/lib/cache.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/_rules.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/equal.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/formats.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/index.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/resolve.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/rules.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/schema_obj.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/ucs2length.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/util.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/validation_error.js
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limit.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limitItems.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limitLength.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limitProperties.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/allOf.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/anyOf.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/coerce.def

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Update selector blacklist

2017-12-07 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396031 )

Change subject: Media: Update selector blacklist
..

Media: Update selector blacklist

Exclude a few more categories:
* Images in error page templates for nonexisting articles
* SiteNotice images
* Slideshow gallery thumbnails

Corresponds with 
https://github.com/wikimedia/mediawiki-extensions-MultimediaViewer/blob/42b577bae97e8079d7695b2684c78c826c2fb846/resources/mmv/mmv.bootstrap.js#L165-L173.

Bug: T177430
Change-Id: I9c4d424dcbb5513d717b38f14c48a1944d756f44
---
M lib/selectors.js
A test/lib/media/media-test-inclusion.js
A test/lib/media/media-test-metadata.js
D test/lib/media/media-test.js
4 files changed, 156 insertions(+), 133 deletions(-)


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

diff --git a/lib/selectors.js b/lib/selectors.js
index 0aa87b9..63c7b76 100644
--- a/lib/selectors.js
+++ b/lib/selectors.js
@@ -13,9 +13,14 @@
 'span.IPA+small a[rel=mw:MediaLink]'
 ];
 
+// Exclusions for various categories of content. See MMVB.isAllowedThumb in 
mediawiki-extensions-
+// MultimediaViewer.
 const MediaBlacklist = [
+'.metadata',
 '.noviewer',
-'.metadata'
+'.noarticletext',
+'#siteNotice',
+'ul.mw-gallery-slideshow li.gallerybox' // thumbnails of a slideshow 
gallery
 ];
 
 const ImageSelectors = MediaSelectors.filter(selector => 
selector.includes('Image'));
diff --git a/test/lib/media/media-test-inclusion.js 
b/test/lib/media/media-test-inclusion.js
new file mode 100644
index 000..c3df360
--- /dev/null
+++ b/test/lib/media/media-test-inclusion.js
@@ -0,0 +1,70 @@
+/* eslint-disable max-len */
+
+'use strict';
+
+const assert = require('../../utils/assert');
+const media = require('../../../lib/media');
+
+const imageFigure = '';
+const imageSpan = '';
+const imageFigureInline = '';
+
+const imageThumbFigure = '';
+const imageThumbSpan = '';
+const imageThumbFigureInline = '';
+
+const videoFigure = '';
+const videoSpan = '';
+const videoFigureInline = '';
+
+const videoThumbFigure = '';
+const videoThumbSpan = '';
+const videoThumbFigureInline = '';
+
+const audioFigure = '';
+const audioSpan = '';
+const audioFigureInline = '';
+
+const noTypeFigure = '';
+const noTypeSpan = '';
+const noTypeFigureInline = '';
+
+const imageNoViewer = '';
+const imageMetadata = '';
+const imageNoArticleText = '';
+const imageSiteNotice = '';
+const imageSlideshowGallery =
+'' +
+'' +
+'' +
+'' +
+'';
+
+const images = [imageFigure, imageSpan, imageFigureInline, imageThumbFigure, 
imageThumbSpan, imageThumbFigureInline];
+const videos = [videoFigure, videoSpan, videoFigureInline, videoThumbFigure, 
videoThumbSpan, videoThumbFigureInline];
+const audio = [audioFigure, audioSpan, audioFigureInline];
+const validItems = images.concat(videos).concat(audio);
+
+const noType = [noTypeFigure, noTypeSpan, noTypeFigureInline];
+const blacklisted = [imageNoViewer, imageMetadata, imageNoArticleText, 
imageSiteNotice, imageSlideshowGallery];
+const invalidItems = noType.concat(blacklisted);
+
+describe('lib:media expected items are included or excluded', () => {
+
+it('items should be found for expected selectors', () => {
+const page = validItems.join('');
+const result = media.getMediaItemInfoFromPage(page);
+assert.deepEqual(result.length, validItems.length);
+assert.deepEqual(result.filter(i => i.title === 'File:Foo').length, 
validItems.length);
+assert.deepEqual(result.filter(i => i.type === 
media.Image.name).length, images.length);
+assert.deepEqual(result.filter(i => i.type === 
media.Video.name).length, videos.length);
+assert.deepEqual(result.filter(i => i.type === 
media.Audio.name).length, audio.length);
+});
+
+it('items should not be found for other selectors', () => {
+const page = invalidItems.join('');
+const result = media.getMediaItemInfoFromPage(page);
+assert.deepEqual(result.length, 0);
+});
+
+});
diff --git a/test/lib/media/media-test-metadata.js 
b/test/lib/media/media-test-metadata.js
new file mode 100644
index 000..d472a2c
--- /dev/null
+++ b/test/lib/media/media-test-metadata.js
@@ -0,0 +1,80 @@
+'use strict';
+
+const assert = require('../../utils/assert');
+const media = require('../../../lib/media');
+
+const imageWithCaption =
+'' +
+'' +
+'An example image' +
+'';
+
+const videoWithMetadata =
+'' +
+'' +
+'';
+
+const videoWithDerivative =
+'' +
+'' +
+'https://example.com/Foo.ogv;' +
+   ' type=\'video/ogg; codecs="theora, vorbis"\'' +
+   ' data-title="Foo"' +
+   ' data-shorttitle="Foo"' +
+   ' data-file-width="120"' +
+   ' data-file-height="120"' +
+'/>' 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Handle long lines in news-sites.js consistently

2017-12-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395921 )

Change subject: Hygiene: Handle long lines in news-sites.js consistently
..

Hygiene: Handle long lines in news-sites.js consistently

Change-Id: I9ca4adc7c287cea25ce079c31019576a8ad4132d
---
M etc/feed/news-sites.js
1 file changed, 6 insertions(+), 11 deletions(-)


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

diff --git a/etc/feed/news-sites.js b/etc/feed/news-sites.js
index ea32f50..15b5c43 100644
--- a/etc/feed/news-sites.js
+++ b/etc/feed/news-sites.js
@@ -44,30 +44,25 @@
 const TOPIC_SELECTOR_LINK = 'a[rel="mw:WikiLink"]:nth-of-type(1)';
 const TOPIC_SELECTOR_BOLD_LINK = 'b:nth-of-type(1) a[rel="mw:WikiLink"]';
 
+/* eslint-disable max-len */
 /**
- * @type {{Object.}} A map of Wikipedia site languages codes
- * to NewsSites
+ * @type {{Object.}} A map of Wikipedia site languages codes 
to NewsSites
  */
 module.exports = {
-da: new NewsSite('Skabelon:Forside_aktuelle_begivenheder', 'div > li',
-TOPIC_SELECTOR_BOLD_LINK),
+da: new NewsSite('Skabelon:Forside_aktuelle_begivenheder', 'div > li', 
TOPIC_SELECTOR_BOLD_LINK),
 de: new NewsSite('Wikipedia:Hauptseite/Aktuelles', 'li', 
TOPIC_SELECTOR_LINK),
 el: new NewsSite('Πύλη:Τρέχοντα_γεγονότα/Επικεφαλίδες', 'li', 
TOPIC_SELECTOR_LINK),
 en: new NewsSite('Template:In_the_news', 'ul[id^=mw] li', 
TOPIC_SELECTOR_BOLD_LINK),
-es: new NewsSite('Portal:Actualidad',
-'table:nth-of-type(1) > tbody > tr > td > ul:nth-of-type(1) > li', 
TOPIC_SELECTOR_LINK),
+es: new NewsSite('Portal:Actualidad', 'table:nth-of-type(1) > tbody > tr > 
td > ul:nth-of-type(1) > li', TOPIC_SELECTOR_LINK),
 fi: new NewsSite('Malline:Uutisissa', 'body > ul > li', 
TOPIC_SELECTOR_BOLD_LINK),
 fr: new NewsSite('Modèle:Accueil_actualité', 'div ul[id^=mw] > li', 
TOPIC_SELECTOR_BOLD_LINK),
 he: new NewsSite('תבנית:חדשות_ואקטואליה', 'body > ul > li', 
TOPIC_SELECTOR_LINK),
 ko: new NewsSite('틀:새로_들어온_소식', 'body > ul > li', 
TOPIC_SELECTOR_BOLD_LINK),
 no: new NewsSite('Mal:Aktuelt', 'ul > li', TOPIC_SELECTOR_BOLD_LINK),
 pl: new NewsSite('Szablon:Aktualności', 'ul:last-of-type > li', 
TOPIC_SELECTOR_BOLD_LINK),
-pt: new NewsSite('Portal:Eventos_atuais', 'table:nth-child(3) ul > li',
-TOPIC_SELECTOR_BOLD_LINK),
-// eslint-disable-next-line max-len
+pt: new NewsSite('Portal:Eventos_atuais', 'table:nth-child(3) ul > li', 
TOPIC_SELECTOR_BOLD_LINK),
 ru: new NewsSite('Шаблон:Текущие_события_на_заглавной_странице', 'body > 
ul > li', TOPIC_SELECTOR_BOLD_LINK),
 sco: new NewsSite('Template:In_the_news', 'ul[id^=mw] li', 
TOPIC_SELECTOR_BOLD_LINK), // see en
-sv: new NewsSite('Portal:Huvudsida/Aktuella händelser', 'body > ul > li',
-TOPIC_SELECTOR_BOLD_LINK),
+sv: new NewsSite('Portal:Huvudsida/Aktuella händelser', 'body > ul > li', 
TOPIC_SELECTOR_BOLD_LINK),
 vi: new NewsSite('Bản_mẫu:Tin_tức', 'ul > li', TOPIC_SELECTOR_BOLD_LINK)
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ca4adc7c287cea25ce079c31019576a8ad4132d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Stop suppressing RESTBase redirect handling when requesting ...

2017-12-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395893 )

Change subject: Stop suppressing RESTBase redirect handling when requesting HTML
..

Stop suppressing RESTBase redirect handling when requesting HTML

Wiki pages occasionally move, and there's no reason not to let RESTBase
handle redirects for us when requesting page HTML. This will make the
service more resilient and improve the stability of our tests.

Updates getMetadataActionApi to return whether the page is a redirect,
so that the summary endpoint can continue to return 204s for redirect
pages per the spec. (Previously, we were relying on the redirect response
not having any results when querying for selector 'body > p'.)

Change-Id: Id42b6aa3c9fe751de74e6cafedfd622811b0c232
---
M lib/mobile-util.js
M lib/mwapi.js
M lib/parsoid-access.js
3 files changed, 12 insertions(+), 12 deletions(-)


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

diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index 46a6c66..087c63a 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -202,6 +202,7 @@
 const isContentModelWikitext = meta.contentmodel === 'wikitext';
 const isWhiteListedNamespace = 
mUtil.SUMMARY_NS_WHITELIST.includes(meta.ns);
 const isMainPage = meta.mainpage;
+const isRedirect = meta.redirect;
 
 if (!isContentModelWikitext) {
 return { code: 204 };
@@ -215,6 +216,10 @@
 return { code: 204 };
 }
 
+if (isRedirect) {
+return { code: 204 };
+}
+
 const leadText = domino.createDocument(page.sections[0].text);
 const intro = transforms.extractLeadIntroduction(leadText);
 
diff --git a/lib/mwapi.js b/lib/mwapi.js
index 80f7bcb..103cc01 100644
--- a/lib/mwapi.js
+++ b/lib/mwapi.js
@@ -168,7 +168,7 @@
 piprop: 'thumbnail|original|name',
 pithumbsize: mwapi.LEAD_IMAGE_XL,
 wbptterms: 'description',
-inprop: ['protection'].join('|'),
+inprop: 'protection',
 rvprop: ['ids', 'timestamp', 'user', 'contentmodel'].join('|'),
 titles: req.params.title,
 prop: props.join('|')
@@ -207,12 +207,8 @@
 const displayTitle = pageprops && pageprops.displaytitle;
 const title = page.title;
 const thumbUrl = page.thumbnail && page.thumbnail.source;
-const thumb = thumbUrl ? {
-url: thumbUrl.replace('https:', '')
-} : undefined;
-const image = page.pageimage ? {
-file: page.pageimage
-} : undefined;
+const thumb = thumbUrl ? { url: thumbUrl.replace('https:', '') } : 
undefined;
+const image = page.pageimage ? { file: page.pageimage } : undefined;
 const protection = page.protection && 
mwapi.simplifyProtectionObject(page.protection);
 const modifier = revision && revision.anon !== undefined ? { anon: 
true } : {};
 modifier.user = revision && revision.user;
@@ -222,6 +218,7 @@
 const talkNsText = page.ns % 2 === 0 ? res.siteinfo.namespaces[page.ns 
+ 1]
 && new Namespace(page.ns + 1, res.siteinfo).getNormalizedText() : 
undefined;
 const mobileHost = res.siteinfo.general.mobileserver;
+const redirect = page.redirect;
 
 return {
 geo,
@@ -249,7 +246,8 @@
 mainpage,
 revision: revision && revision.revid,
 description: page.terms && page.terms.description[0],
-mobileHost
+mobileHost,
+redirect
 };
 });
 }
diff --git a/lib/parsoid-access.js b/lib/parsoid-access.js
index 027a156..8f7aeaf 100644
--- a/lib/parsoid-access.js
+++ b/lib/parsoid-access.js
@@ -38,10 +38,7 @@
 return mwapi.getDbTitle(app, req, req.params.title)
 .then((title) => {
 const path = `page/html/${encodeURIComponent(title)}${suffix}`;
-const restReq = {
-query: { redirect: 'false' },
-headers: { accept: PARSOID_ACCEPT_HEADER }
-};
+const restReq = { headers: { accept: PARSOID_ACCEPT_HEADER } };
 
 return api.restApiGet(app, domain, path, restReq);
 });

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id42b6aa3c9fe751de74e6cafedfd622811b0c232
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix ruwiki news template

2017-12-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395867 )

Change subject: Fix ruwiki news template
..

Fix ruwiki news template

The template was renamed.

https://ru.wikipedia.org/w/index.php?title=%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%A2%D0%B5%D0%BA%D1%83%D1%89%D0%B8%D0%B5_%D1%81%D0%BE%D0%B1%D1%8B%D1%82%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%B7%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B9_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B5=history

Change-Id: I1c1025f42a84a4b5f8ca850db01dbc76ae3d82c2
---
M etc/feed/news-sites.js
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/etc/feed/news-sites.js b/etc/feed/news-sites.js
index 7e6f627..e4d3374 100644
--- a/etc/feed/news-sites.js
+++ b/etc/feed/news-sites.js
@@ -47,6 +47,8 @@
 /**
  * @type {{Object.}} A map of Wikipedia site languages codes
  * to NewsSites
+ *
+ * eslint-disable max-len
  */
 module.exports = {
 da: new NewsSite('Skabelon:Forside_aktuelle_begivenheder', 'div > li',
@@ -64,7 +66,8 @@
 pl: new NewsSite('Szablon:Aktualności', 'ul:last-of-type > li', 
TOPIC_SELECTOR_BOLD_LINK),
 pt: new NewsSite('Portal:Eventos_atuais', 'table:nth-child(3) ul > li',
 TOPIC_SELECTOR_BOLD_LINK),
-ru: new NewsSite('Шаблон:Актуальные_события', 'body > ul > li', 
TOPIC_SELECTOR_BOLD_LINK),
+// eslint-disable-next-line max-len
+ru: new NewsSite('Шаблон:Текущие_события_на_заглавной_странице', 'body > 
ul > li', TOPIC_SELECTOR_BOLD_LINK),
 sco: new NewsSite('Template:In_the_news', 'ul[id^=mw] li', 
TOPIC_SELECTOR_BOLD_LINK), // see en
 sv: new NewsSite('Portal:Huvudsida/Aktuella händelser', 'body > ul > li',
 TOPIC_SELECTOR_BOLD_LINK),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c1025f42a84a4b5f8ca850db01dbc76ae3d82c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Update mobileapps to ee50d59

2017-12-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395859 )

Change subject: Update mobileapps to ee50d59
..

Update mobileapps to ee50d59

List of changes:
4f0d18e tag-deploy: push only the created tag
f8ef398 Batch MW API query requests
dc44d64 Get derivatives from Parsoid HTML and call imageinfo for metadata
48255b0 Add diff test for the media endpoint
621b41d Add audio files to response
9788357 Add on-wiki captions to media response
fbf06a2 Add thumb_mime and duration to media output
0d5db1c Media: move extmetadata properties of interest into the top level
19f078f Report image properties in standard image objects
969e277 Media: Add thumb_time to video items, if it exists
c346c71 Hygiene: Remove NSP workaround for moment.js
9a896c2 Media: Mark spoken WP files with audio_type: spoken
0e94a9e Media: exclude 'width' and 'height' properties from audio items
c9f0480 Hygiene: Add media selector unit tests
f247cd5 Media: Unit testing for metadata and derivatives parsing
fb876d1 Media: Add pronunciation audio files
abd03a8 Hygiene: Fix fixVideoAnchor test
71fde87 Hygiene: Consolidate media selectors
cdda9f6 Fix: restore video derivatives
764f838 Hygiene: remove adjustMemberKeys and fillInMemberKeys from mobile-util
f14174d Fix broken tests
bbaa87b Media endpoint output tweaks, pt. 1
d30f725 Media endpoint output tweaks, pt. 2: derivatives
1c6e047 Media: Add page count for paged items (PDF, TIFF, DjVu, etc.)
d9b7665 Media: Exclude .noviewer and .metadata items
c49685a Hygiene: Use Element.closest where appropriate
ee50d59 Version number for the media endpoint
xxx Update node module dependencies

Change-Id: I070e692c96484d46b3096b79b8bc28049a7a806d
---
M node_modules/abbrev/LICENSE
M node_modules/abbrev/package.json
M node_modules/ajv/dist/ajv.bundle.js
M node_modules/ajv/dist/ajv.min.js
M node_modules/ajv/dist/ajv.min.js.map
M node_modules/ajv/dist/nodent.min.js
M node_modules/ajv/dist/regenerator.min.js
M node_modules/ajv/lib/ajv.js
M node_modules/ajv/package.json
M node_modules/aproba/index.js
M node_modules/aproba/package.json
A node_modules/are-we-there-yet/CHANGES.md~
M node_modules/are-we-there-yet/package.json
M node_modules/block-stream/package.json
A node_modules/console-control-strings/README.md~
M node_modules/console-control-strings/package.json
M node_modules/cryptiles/.npmignore
M node_modules/deep-extend/package.json
M node_modules/delegates/package.json
M node_modules/esprima/dist/esprima.js
M node_modules/fs.realpath/package.json
M node_modules/fstream-ignore/package.json
M node_modules/fstream/package.json
M node_modules/gauge/package.json
M node_modules/gc-stats/.travis.yml
M node_modules/gc-stats/appveyor.yml
D 
node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v48-linux-x64/gcstats.node
A 
node_modules/gc-stats/build/gcstats/v1.1.0/Release/node-v48-linux-x64/gcstats.node
D node_modules/gc-stats/node_modules/.bin/mkdirp
D node_modules/gc-stats/node_modules/.bin/uuid
D node_modules/gc-stats/node_modules/ajv/.tonic_example.js
D node_modules/gc-stats/node_modules/ajv/LICENSE
D node_modules/gc-stats/node_modules/ajv/dist/ajv.bundle.js
D node_modules/gc-stats/node_modules/ajv/dist/ajv.min.js
D node_modules/gc-stats/node_modules/ajv/dist/ajv.min.js.map
D node_modules/gc-stats/node_modules/ajv/dist/nodent.min.js
D node_modules/gc-stats/node_modules/ajv/dist/regenerator.min.js
D node_modules/gc-stats/node_modules/ajv/lib/ajv.d.ts
D node_modules/gc-stats/node_modules/ajv/lib/ajv.js
D node_modules/gc-stats/node_modules/ajv/lib/async.js
D node_modules/gc-stats/node_modules/ajv/lib/cache.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/_rules.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/equal.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/formats.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/index.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/resolve.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/rules.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/schema_obj.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/ucs2length.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/util.js
D node_modules/gc-stats/node_modules/ajv/lib/compile/validation_error.js
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limit.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limitItems.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limitLength.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/_limitProperties.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/allOf.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/anyOf.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/coerce.def
D node_modules/gc-stats/node_modules/ajv/lib/dot/custom.jst
D node_modules/gc-stats/node_modules/ajv/lib/dot/defaults.def
D node_modules/gc-stats/node_modules/ajv/lib/dot/definitions.def
D 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix broken tests

2017-12-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395840 )

Change subject: Fix broken tests
..

Fix broken tests

These tests should point at the real page and not the redirect page since
we're not testing redirect handling.  This fixes the build; let's figure
out why they were failing later.

Change-Id: If7017392c2869d6115d3cab4adea568bc791050d
---
M test/features/mobile-sections-lead/pagecontent.js
M test/features/mobile-sections/pagecontent-v2.js
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/test/features/mobile-sections-lead/pagecontent.js 
b/test/features/mobile-sections-lead/pagecontent.js
index 7f093b1..a5ec47a 100644
--- a/test/features/mobile-sections-lead/pagecontent.js
+++ b/test/features/mobile-sections-lead/pagecontent.js
@@ -212,7 +212,7 @@
 });
 });
 it('Enwiki hatnotes are promoted to the lead object', () => {
-const title = `Chivalric%20order`;
+const title = `Order%20of%20chivalry`;
 const uri = 
`${server.config.uri}${wikiSectionsLead}${title}/699553745`;
 const anchor = ``;
 return preq.get({ uri })
diff --git a/test/features/mobile-sections/pagecontent-v2.js 
b/test/features/mobile-sections/pagecontent-v2.js
index 439a24d..d8a0ae5 100644
--- a/test/features/mobile-sections/pagecontent-v2.js
+++ b/test/features/mobile-sections/pagecontent-v2.js
@@ -33,7 +33,7 @@
 // special
 
 it('Hatnotes do not appear in the lead object', () => {
-const title = 'Chivalric%20order/699553745';
+const title = 'Order%20of%20chivalry/699553745';
 const uri = 
`${server.config.uri}en.wikipedia.org/v1/page/formatted/${title}`;
 const anchor = '';
 return preq.get({ uri })

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If7017392c2869d6115d3cab4adea568bc791050d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Use Element.closest where appropriate

2017-12-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395781 )

Change subject: Hygiene: Use Element.closest where appropriate
..

Hygiene: Use Element.closest where appropriate

Change-Id: Ia2182efe3f8c2877674b042f72ff583b566392fc
---
M lib/media.js
M lib/mobile-util.js
M lib/selectors.js
3 files changed, 3 insertions(+), 12 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index 136aa86..6e6f81b 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -2,7 +2,6 @@
 
 const domino = require('domino');
 const api = require('./api-util');
-const mUtil = require('./mobile-util');
 const Title = require('mediawiki-title').Title;
 const Selectors = require('./selectors').MediaSelectors;
 const Blacklist = require('./selectors').MediaBlacklist;
@@ -92,12 +91,8 @@
 };
 });
 } else if (mediaType === Audio) {
-let parent = elem.parentNode;
-while (parent) {
-if (mUtil.isElement(parent) && parent.id === 
SpokenWikipediaId) {
-audioType = 'spoken';
-}
-parent = parent.parentNode;
+if (elem.closest(SpokenWikipediaId)) {
+audioType = 'spoken';
 }
 } else if (mediaType === Pronunciation) {
 title = `File:${elem.getAttribute('title')}`;
diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index ee28266..e26114a 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -51,10 +51,6 @@
 
 mUtil.isNonempty = underscore.negate(mUtil.isEmpty);
 
-mUtil.isElement = function(node) {
-return node.nodeType === NodeType.ELEMENT_NODE;
-};
-
 /**
  * @param {*} val input value
  * @param {*} [fallback] the default value to assign if val is empty
diff --git a/lib/selectors.js b/lib/selectors.js
index 3e66897..0aa87b9 100644
--- a/lib/selectors.js
+++ b/lib/selectors.js
@@ -22,7 +22,7 @@
 const VideoSelectors = MediaSelectors.filter(selector => 
selector.includes('Video'));
 const PronunciationSelector = MediaSelectors.filter(selector => 
selector.includes('IPA'))[0];
 
-const SpokenWikipediaId = 'section_SpokenWikipedia';
+const SpokenWikipediaId = '#section_SpokenWikipedia';
 
 
 module.exports = {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2182efe3f8c2877674b042f72ff583b566392fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Exclude .noviewer and .metadata items

2017-12-05 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395653 )

Change subject: Media: Exclude .noviewer and .metadata items
..

Media: Exclude .noviewer and .metadata items

Looks like this mostly overlaps with our size- and mime-based filtering.

Bug: T177430
Change-Id: Idfe8664cf187e0811a27dbce94a1f361e42cb910
---
M lib/selectors.js
M test/lib/media/media-test.js
2 files changed, 13 insertions(+), 10 deletions(-)


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

diff --git a/lib/selectors.js b/lib/selectors.js
index 835aac7..213ebed 100644
--- a/lib/selectors.js
+++ b/lib/selectors.js
@@ -1,15 +1,15 @@
 'use strict';
 
 const MediaSelectors = [
-'figure[typeof^=mw:Image]',
-'figure[typeof^=mw:Video]',
-'figure[typeof^=mw:Audio]',
-'span[typeof^=mw:Image]',
-'span[typeof^=mw:Video]',
-'span[typeof^=mw:Audio]',
-'figure-inline[typeof^=mw:Image]',
-'figure-inline[typeof^=mw:Video]',
-'figure-inline[typeof^=mw:Audio]',
+'figure[typeof^=mw:Image]:not(.noviewer,.metadata)',
+'figure[typeof^=mw:Video]:not(.noviewer,.metadata)',
+'figure[typeof^=mw:Audio]:not(.noviewer,.metadata)',
+'span[typeof^=mw:Image]:not(.noviewer,.metadata)',
+'span[typeof^=mw:Video]:not(.noviewer,.metadata)',
+'span[typeof^=mw:Audio]:not(.noviewer,.metadata)',
+'figure-inline[typeof^=mw:Image]:not(.noviewer,.metadata)',
+'figure-inline[typeof^=mw:Video]:not(.noviewer,.metadata)',
+'figure-inline[typeof^=mw:Audio]:not(.noviewer,.metadata)',
 'span.IPA+small a[rel=mw:MediaLink]'
 ];
 
diff --git a/test/lib/media/media-test.js b/test/lib/media/media-test.js
index 7ab95bd..2fd8020 100644
--- a/test/lib/media/media-test.js
+++ b/test/lib/media/media-test.js
@@ -29,12 +29,15 @@
 const noTypeSpan = '';
 const noTypeFigureInline = '';
 
+const imageNoViewer = '';
+const imageMetadata = '';
+
 const images = [imageFigure, imageSpan, imageFigureInline, imageThumbFigure, 
imageThumbSpan, imageThumbFigureInline];
 const videos = [videoFigure, videoSpan, videoFigureInline, videoThumbFigure, 
videoThumbSpan, videoThumbFigureInline];
 const audio = [audioFigure, audioSpan, audioFigureInline];
 
 const validItems = images.concat(videos).concat(audio);
-const invalidItems = [noTypeFigure, noTypeSpan, noTypeFigureInline];
+const invalidItems = [noTypeFigure, noTypeSpan, noTypeFigureInline, 
imageNoViewer, imageMetadata];
 
 const imageWithCaption =
 '' +

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfe8664cf187e0811a27dbce94a1f361e42cb910
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media: Add page count for paged items (PDF, TIFF)

2017-12-05 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395643 )

Change subject: Media: Add page count for paged items (PDF, TIFF)
..

Media: Add page count for paged items (PDF, TIFF)

Bug: T177430
Change-Id: I94b5c6222a99c7474b019191255e7bb179e23f41
---
M lib/media.js
M spec.yaml
M test/diff/results/page_media-enwiki-Hummingbird.json
M test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
4 files changed, 7 insertions(+), 0 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index dce92e6..aeae4e8 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -148,6 +148,7 @@
 height: info.mediatype === 'AUDIO' ? undefined : info.height,
 mime: info.mime,
 },
+page_count: info.pagecount,
 file_page: `https://commons.wikimedia.org/wiki/${canonical}`,
 duration: meta && (meta.length || meta.playtime_seconds) || 
undefined,
 artist: ext && ext.Artist && ext.Artist.value,
@@ -184,6 +185,7 @@
 'url',
 'dimensions',
 'mime',
+'size',
 'thumbmime',
 'mediatype',
 'metadata',
diff --git a/spec.yaml b/spec.yaml
index aabb1dc..714ce55 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -1285,6 +1285,9 @@
 size:
   type: integer
   description: the original file size in bytes (sizes are not provided 
for video derivatives)
+  page_count:
+type: integer
+description: page count, if the item is a paged item (PDF or TIFF)
   file_page:
 type: string
 description: Full URL to the file page for the item on Wikimedia 
Commons
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index b62bb3f..1bf7b9c 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -320,6 +320,7 @@
 "height": 2083,
 "mime": "image/tiff"
   },
+  "page_count": 1,
   "file_page": 
"https://commons.wikimedia.org/wiki/File:Velvet-purple_coronets_sequence.tif;,
   "artist": "Unherdable",
   "credit": "Own work",
diff --git a/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json 
b/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
index 40c38e8..a2eca8a 100644
--- a/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
+++ b/test/diff/results/page_media-enwiki-Ko%C5%A1ice.json
@@ -23,6 +23,7 @@
 "height": 2202,
 "mime": "image/tiff"
   },
+  "page_count": 1,
   "file_page": 
"https://commons.wikimedia.org/wiki/File:Fő_utcza,_Kassa_-_1902_(1).tif",
   "artist": "Unknown photographer (scanned by Derzsi Elekes 
Andor)",
   "credit": "Courtesy of Derzsi Elekes Andor",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I94b5c6222a99c7474b019191255e7bb179e23f41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Media endpoint output tweaks, pt. 2: derivatives

2017-12-05 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395599 )

Change subject: Media endpoint output tweaks, pt. 2: derivatives
..

Media endpoint output tweaks, pt. 2: derivatives

* Change 'derivatives' property name to 'sources'
* Remove 'original' property for videos since the original is present in
  the sources
* Split 'type' property into 'mime' and 'codecs'

Bug: T177430
Change-Id: I411925b4db1bcb698dc0e5198fac617eef54d65b
---
M lib/media.js
M routes/media.js
M spec.yaml
M test/diff/results/page_media-enwiki-Hummingbird.json
M test/lib/media/media-test.js
5 files changed, 103 insertions(+), 61 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index 23a381a..894e61a 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -67,7 +67,7 @@
 let endTime;
 let thumbTime;
 let audioType;
-let derivatives;
+let sources;
 if (mediaType === Video) {
 const dataMw = JSON.parse(elem.getAttribute('data-mw'));
 if (dataMw) {
@@ -75,19 +75,19 @@
 endTime = dataMw.endtime;
 thumbTime = dataMw.thumbtime;
 }
-const sources = elem.getElementsByTagName('source');
-if (sources.length) {
-derivatives = [].map.call(sources, (source) => {
-return {
-source: source.getAttribute('src'),
-type: source.getAttribute('type'),
-title: source.getAttribute('data-title'),
-short_title: source.getAttribute('data-shorttitle'),
-width: source.getAttribute('data-file-width') || 
undefined,
-height: source.getAttribute('data-file-height') || 
undefined
-};
-});
-}
+const sourceElems = elem.getElementsByTagName('source');
+sources = [].map.call(sourceElems, (source) => {
+return {
+source: source.getAttribute('src'),
+mime: source.getAttribute('type').split('; ')[0],
+// eslint-disable-next-line no-useless-escape
+codecs: source.getAttribute('type').split('; 
')[1].split('\"')[1].split(', '),
+title: source.getAttribute('data-title'),
+short_title: source.getAttribute('data-shorttitle'),
+width: source.getAttribute('data-file-width') || undefined,
+height: source.getAttribute('data-file-height') || 
undefined
+};
+});
 } else if (mediaType === Audio) {
 let parent = elem.parentNode;
 while (parent) {
@@ -109,7 +109,7 @@
 end_time: endTime,
 thumb_time: thumbTime,
 audio_type: audioType,
-derivatives
+sources
 };
 });
 }
@@ -162,7 +162,7 @@
 // Reject gallery items if they're too small.
 // Also reject SVG and PNG items by default, because they're likely to be
 // logos and/or presentational images.
-return item.original && item.original.source
+return item.sources || item.original && item.original.source
 && (item.type === Audio.name || item.original.width >= MIN_IMAGE_SIZE)
 && (item.type === Audio.name || item.original.height >= MIN_IMAGE_SIZE)
 && !item.original.mime.includes('svg')
diff --git a/routes/media.js b/routes/media.js
index cea40bc..fb39932 100644
--- a/routes/media.js
+++ b/routes/media.js
@@ -32,6 +32,11 @@
 if (mediaItem.title === metadataItem.titles.canonical) {
 Object.assign(mediaItem, metadataItem);
 delete mediaItem.title;
+
+// delete 'original' property for videos
+if (mediaItem.sources) {
+delete mediaItem.original;
+}
 }
 });
 });
diff --git a/spec.yaml b/spec.yaml
index 109bd34..e79baa9 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -597,11 +597,6 @@
 width: /.+/
 height: /.+/
 mime: /.+/
-  original:
-source: /.+/
-width: /.+/
-height: /.+/
-mime: /.+/
   license: /.+/
 
   # from routes/definition.js
@@ -1314,7 +1309,7 @@
   duration:
 type: number
 description: the playback duration in seconds (for audio and video 
items)
-  derivatives:
+  sources:
 type: array
 description: a list of derivatives of the original file (applies only 
to videos)
 items:
@@ 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Further cleanup of lib/most-read

2017-12-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395161 )

Change subject: Further cleanup of lib/most-read
..

Further cleanup of lib/most-read

Note: This change removes the pageid field from the response items.
(Hence not marking this with Hygiene.) Is pageid actually used by clients?

Change-Id: I9d95e77330cfd3e65c8d456b1b69f2c60ed1cce8
---
M lib/feed/most-read-filter.js
M lib/feed/most-read.js
M test/diff/diff.js
M test/diff/results/page_most-read-enwiki-2016-01-01.json
4 files changed, 52 insertions(+), 120 deletions(-)


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

diff --git a/lib/feed/most-read-filter.js b/lib/feed/most-read-filter.js
index f99177e..269b346 100644
--- a/lib/feed/most-read-filter.js
+++ b/lib/feed/most-read-filter.js
@@ -21,10 +21,10 @@
 return BLACKLIST.indexOf(title) !== -1;
 }
 
-function filterSpecialPages(pages, mainPageTitle) {
+function filterSpecial(articles, mainPageTitle) {
 const mainPageRegExp = new RegExp(`^${escape(mainPageTitle)}$`, 'i');
-return pages.filter((page) => {
-return page.ns === 0 && !mainPageRegExp.test(page.title);
+return articles.filter((page) => {
+return page.ns === 0 && !mainPageRegExp.test(page.article);
 });
 }
 
@@ -34,7 +34,7 @@
  * relatively even mix of the two, are presumed to be inflated by bot traffic
  * and not of sufficient human interest to include in the feed.
  */
-function filterBotTraffic(allPlatformsMostRead, desktopMostRead) {
+function filterBots(allPlatformsMostRead, desktopMostRead) {
 
 if (BOT_FILTER_THRESHOLD < 0 || BOT_FILTER_THRESHOLD > 1) {
 throw new HTTPError({
@@ -62,6 +62,6 @@
 }
 
 module.exports = {
-filterSpecialPages,
-filterBotTraffic
+filterSpecial,
+filterBots
 };
diff --git a/lib/feed/most-read.js b/lib/feed/most-read.js
index 6ea5333..22e856f 100644
--- a/lib/feed/most-read.js
+++ b/lib/feed/most-read.js
@@ -7,9 +7,11 @@
 const BBPromise = require('bluebird');
 const mUtil = require('../mobile-util');
 const mwapi = require('../mwapi');
-const filter = require('./most-read-filter');
+const filterSpecial = require('./most-read-filter').filterSpecial;
+const filterBots = require('./most-read-filter').filterBots;
 const dateUtil = require('../dateUtil');
 const pageviews = require('../pageviews');
+const Title = require('mediawiki-title').Title;
 
 /**
  * @public {!string} date ISO 8601 timestamp of pageviews recorded
@@ -23,14 +25,8 @@
 }
 
 function getTopPageviews(app, req, domain, date) {
-const apiDomain = 'wikimedia.org';
-const restReq = {
-headers: { accept: 'application/json; charset=utf-8' }
-};
-const client = new pageviews.Client(app, apiDomain, restReq);
-
-// todo: remove manual bot filtering when a user agent parameter is 
available for top as in the
-//   per-article endpoint
+const restReq = { headers: { accept: 'application/json; charset=utf-8' } };
+const client = new pageviews.Client(app, 'wikimedia.org', restReq);
 return BBPromise.props({
 desktop: client.reqTop(domain, pageviews.Platform.DESKTOP_WEB, date),
 combined: client.reqTop(domain, pageviews.Platform.ALL, date)
@@ -43,29 +39,33 @@
 });
 }
 
-function promise(app, req) {
-const aggregated = !!req.query.aggregated;
-let goodTitles;
-let resultsDate;
+function getViewHistory(app, domain, startDate, endDate, entry) {
+const restReq = { headers: { accept: 'application/json; charset=utf-8' } };
+const client = new pageviews.Client(app, 'wikimedia.org', restReq);
+return client.reqPage(mUtil.removeTLD(domain), pageviews.Platform.ALL, 
pageviews.Agent.USER,
+entry.article, pageviews.Granularity.DAILY, startDate, endDate)
+.then(pageviewsPageRspToDatedPageviews);
+}
 
+function promise(app, req) {
 if (req.params.domain === 'fy.wikipedia.org') {
 return BBPromise.resolve({ meta: {} });
 }
 
 if (!dateUtil.validate(dateUtil.hyphenDelimitedDateString(req))) {
-if (aggregated) {
+if (req.query.aggregated) {
 return BBPromise.resolve({ meta: {} });
 }
 dateUtil.throwDateError();
 }
 
-const targetDomain = 
mUtil.removeTLD(mUtil.mobileToCanonical(req.params.domain));
-
 const reqDate = dateUtil.getRequestedDate(req);
-const date = aggregated ? dateUtil.addDays(reqDate, -1) : reqDate;
+const rspDate = req.query.aggregated ? dateUtil.addDays(reqDate, -1) : 
reqDate;
 
-return getTopPageviews(app, req, targetDomain, date)
-.then((response) => {
+return BBPromise.props({
+pageviews: getTopPageviews(app, req, 
mUtil.removeTLD(req.params.domain), rspDate),
+siteinfo: mwapi.getSiteInfo(app, req)
+}).then((response) => {
 // We're working mainly with the overall list of top pageviews, and cut
 // 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Dev: Lint on pre-commit, not when running unit tests

2017-12-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395155 )

Change subject: Dev: Lint on pre-commit, not when running unit tests
..

Dev: Lint on pre-commit, not when running unit tests

Linting is important but can be a nuisance during a rapid debugging and
testing cycle if run alongside the unit tests.  This patch moves the lint
command to a pre-commit hook to ameliorate this problem.

Change-Id: Ie78d3bed3608adcc2c4bbf38bd0fd981b8c91702
---
M package.json
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/package.json b/package.json
index 99133cf..9e916e9 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
   "main": "./app.js",
   "scripts": {
 "start": "service-runner",
-"test": "npm run -s lint && PREQ_CONNECT_TIMEOUT=15 mocha && nsp check",
+"test": "PREQ_CONNECT_TIMEOUT=15 mocha && nsp check",
 "test:unit": "PREQ_CONNECT_TIMEOUT=15 mocha test/lib",
 "lint": "eslint --cache --max-warnings 0 --ext .js --ext .json .",
 "docker-start": "service-runner docker-start",
@@ -13,6 +13,9 @@
 "test-build": "service-runner docker-test && service-runner build 
--deploy-repo --force",
 "coverage": "istanbul cover _mocha -- -R spec"
   },
+  "pre-commit": [
+"lint"
+  ],
   "repository": {
 "type": "git",
 "url": "https://gerrit.wikimedia.org/r/mediawiki/services/mobileapps;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie78d3bed3608adcc2c4bbf38bd0fd981b8c91702
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: remove adjustMemberKeys and fillInMemberKeys from m...

2017-12-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395099 )

Change subject: Hygiene: remove adjustMemberKeys and fillInMemberKeys from 
mobile-util
..

Hygiene: remove adjustMemberKeys and fillInMemberKeys from mobile-util

Standard Array functions can and should be used to perform these
operations.

Change-Id: Iefabb9e8e56a5be9bb2c80979b605c8398cecc23
---
M lib/feed/most-read.js
M lib/mobile-util.js
M test/lib/mobile-util/mobile-util-test.js
3 files changed, 8 insertions(+), 70 deletions(-)


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

diff --git a/lib/feed/most-read.js b/lib/feed/most-read.js
index 862e1b0..6ea5333 100644
--- a/lib/feed/most-read.js
+++ b/lib/feed/most-read.js
@@ -22,17 +22,6 @@
 }
 }
 
-/**
- * Construct a list of title strings from the array of good article objects.
- */
-function constructQueryListFrom(goodTitles) {
-const result = [];
-for (let i = 0, n = goodTitles.length; i < n; i++) {
-result.push(goodTitles[i].article);
-}
-return result;
-}
-
 function getTopPageviews(app, req, domain, date) {
 const apiDomain = 'wikimedia.org';
 const restReq = {
@@ -94,11 +83,13 @@
 const desktopItems = desktopResults && desktopResults.items;
 const firstDesktopItems = desktopItems && desktopResults.items[0];
 const combinedArticles = firstCombinedItems && 
firstCombinedItems.articles;
-const combinedArticlesSlice = combinedArticles && 
combinedArticles.slice(0, QUERY_TITLES);
+const combinedSlice = combinedArticles && combinedArticles.slice(0, 
QUERY_TITLES);
 const desktopArticles = firstDesktopItems && 
firstDesktopItems.articles;
-const desktopArticlesSlice = desktopArticles && 
desktopArticles.slice(0, DESKTOP_TITLES);
+const desktopSlice = desktopArticles && desktopArticles.slice(0, 
DESKTOP_TITLES);
 
-goodTitles = filter.filterBotTraffic(combinedArticlesSlice, 
desktopArticlesSlice);
+goodTitles = filter.filterBotTraffic(combinedSlice, desktopSlice)
+.map(i => Object.assign({ title: i.article }, i));
+
 if (mUtil.isEmpty(goodTitles)) {
 mUtil.throw404('No results found.');
 }
@@ -107,7 +98,7 @@
 const month = firstCombinedItems.month;
 const day = firstCombinedItems.day;
 resultsDate = `${year}-${month}-${day}Z`;
-return mwapi.getMostReadMetadata(app, req, 
constructQueryListFrom(goodTitles).join('|'));
+return mwapi.getMostReadMetadata(app, req, goodTitles.map(i => 
i.article).join('|'));
 }).then((response) => {
 const query = response.body && response.body.query;
 const normalizations = query && query.normalized;
@@ -119,11 +110,10 @@
 }
 
 if (normalizations) {
-mUtil.adjustMemberKeys(normalizations, ['article', 'from'], 
['title', 'to']);
-mUtil.mergeByProp(goodTitles, normalizations, 'article');
+const adjusted = normalizations.map(norm => ({ article: norm.from, 
title: norm.to }));
+mUtil.mergeByProp(goodTitles, adjusted, 'article');
 }
 
-mUtil.fillInMemberKeys(goodTitles, ['title', 'article']);
 mUtil.mergeByProp(goodTitles, pages, 'title', true);
 
 goodTitles = filter.filterSpecialPages(goodTitles, mainPageTitle);
diff --git a/lib/mobile-util.js b/lib/mobile-util.js
index ee461ad..ee28266 100644
--- a/lib/mobile-util.js
+++ b/lib/mobile-util.js
@@ -166,41 +166,6 @@
 });
 };
 
-/**
- * Takes an array of objects and makes the specified changes to the keys of 
each
- * member object. E.g., adjustMemberKeys(arr, ['to', 'from'], ['to', 'from'], 
...)
- * @param {!Array} arr an array of objects that will receive the change pairs 
passed in as
- * additional params
- */
-mUtil.adjustMemberKeys = function(arr) {
-for (let i = 0, n = arr.length; i < n; i++) {
-for (let j = 1, m = arguments.length; j < m; j++) {
-if (arr[i][arguments[j][1]]) {
-arr[i][arguments[j][0]] = arr[i][arguments[j][1]];
-delete arr[i][arguments[j][1]];
-}
-}
-}
-};
-
-/**
- * Takes an array of objects and, for each object, creates the specified key 
(if
- * not already present) with the same value as the specified source key for 
each
- * change pair passed in as an additional parameter.
- * E.g., fillInMemberKeys(arr, ['to', 'from'], ['to', 'from'], ...)
- * @param {!Array} arr an array of objects that will receive the change pairs 
passed in as
- * additional params
- */
-mUtil.fillInMemberKeys = function(arr) {
-for (let i = 0, n = arr.length; i < n; i++) {
-for (let j = 1, m = arguments.length; j < m; j++) {
-if (!arr[i][arguments[j][0]]) {
-arr[i][arguments[j][0]] = arr[i][arguments[j][1]];
-}
-}
-}

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Fix: restore video derivatives

2017-12-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395084 )

Change subject: Fix: restore video derivatives
..

Fix: restore video derivatives

Video derivatives were no longer being included in the media response,
probably because of a rebase error.

Change-Id: Ic948c00bddcd98d7cef5cf5c523bdb23aed79cb6
---
M lib/media.js
M test/diff/results/page_media-enwiki-Hummingbird.json
2 files changed, 104 insertions(+), 3 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index bf6c6a5..24a5a18 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -83,8 +83,8 @@
 type: source.getAttribute('type'),
 title: source.getAttribute('data-title'),
 short_title: source.getAttribute('data-shorttitle'),
-width: source.getAttribute('data-file-width'),
-height: source.getAttribute('data-file-height')
+width: source.getAttribute('data-file-width') || 
undefined,
+height: source.getAttribute('data-file-height') || 
undefined
 };
 });
 }
@@ -144,7 +144,6 @@
 size: info.size
 },
 duration: meta && (meta.length || meta.playtime_seconds) || 
undefined,
-derivatives: info.derivatives,
 artist: ext && ext.Artist && ext.Artist.value,
 credit: ext && ext.Credit && ext.Credit.value,
 license: ext && ext.LicenseShortName && ext.LicenseShortName.value,
diff --git a/test/diff/results/page_media-enwiki-Hummingbird.json 
b/test/diff/results/page_media-enwiki-Hummingbird.json
index 851503a..a022bdd 100644
--- a/test/diff/results/page_media-enwiki-Hummingbird.json
+++ b/test/diff/results/page_media-enwiki-Hummingbird.json
@@ -187,6 +187,40 @@
   "type": "video",
   "caption_html": "Slow motion video of hummingbirds feeding",
   "caption_text": "Slow motion video of hummingbirds feeding",
+  "derivatives": [
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/2/21/Hummingbird_feeding_closeup_2000fps.webm;,
+  "type": "video/webm; codecs=\"vp8, vorbis\"",
+  "title": "Original WebM file, 864 × 480 (955 kbps)",
+  "short_title": "WebM source",
+  "width": "864",
+  "height": "480"
+},
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.160p.webm;,
+  "type": "video/webm; codecs=\"vp8, vorbis\"",
+  "title": "Low bandwidth WebM (160P)",
+  "short_title": "WebM 160P"
+},
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.240p.webm;,
+  "type": "video/webm; codecs=\"vp8, vorbis\"",
+  "title": "Small WebM (240P)",
+  "short_title": "WebM 240P"
+},
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.360p.webm;,
+  "type": "video/webm; codecs=\"vp8, vorbis\"",
+  "title": "WebM (360P)",
+  "short_title": "WebM 360P"
+},
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/2/21/Hummingbird_feeding_closeup_2000fps.webm/Hummingbird_feeding_closeup_2000fps.webm.480p.webm;,
+  "type": "video/webm; codecs=\"vp8, vorbis\"",
+  "title": "SD WebM (480P)",
+  "short_title": "WebM 480P"
+}
+  ],
   "thumb": {
 "source": 
"https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Hummingbird_feeding_closeup_2000fps.webm/864px--Hummingbird_feeding_closeup_2000fps.webm.jpg;,
 "width": 864,
@@ -256,6 +290,40 @@
   "type": "video",
   "caption_html": "Hummingbird in Copiapó, Chile: The apparent slow movement of its 
wings is a result of the stroboscopic effect.",
   "caption_text": "Hummingbird in Copiapó, Chile: The apparent slow 
movement of its wings is a result of the stroboscopic effect.",
+  "derivatives": [
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/d/db/Hummingbird.ogv;,
+  "type": "video/ogg; codecs=\"theora, vorbis\"",
+  "title": "Original Ogg file, 854 × 480 (2.55 Mbps)",
+  "short_title": "Ogg source",
+  "width": "854",
+  "height": "480"
+},
+{
+  "src": 
"https://upload.wikimedia.org/wikipedia/commons/transcoded/d/db/Hummingbird.ogv/Hummingbird.ogv.160p.webm;,
+  "type": "video/webm; codecs=\"vp8, 

[MediaWiki-commits] [Gerrit] mediawiki...mobileapps[master]: Hygiene: Consolidate media selectors

2017-12-04 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395056 )

Change subject: Hygiene: Consolidate media selectors
..

Hygiene: Consolidate media selectors

Share media selectors between the page transformations and the media
endpoint.  No output changes intended.

Change-Id: Icb881eb3d8663ed2d2723e4c03e68b3e8fd0aa82
---
M lib/media.js
A lib/selectors.js
M lib/transformations/anchorPopUpMediaTransforms.js
M lib/transforms.js
4 files changed, 38 insertions(+), 66 deletions(-)


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

diff --git a/lib/media.js b/lib/media.js
index 0de4391..97d1b83 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -4,22 +4,11 @@
 const api = require('./api-util');
 const mUtil = require('./mobile-util');
 const Title = require('mediawiki-title').Title;
+const MediaSelectors = require('./selectors').MediaSelectors;
 
 const MIN_IMAGE_SIZE = 64;
 const MAX_IMAGE_WIDTH = 1280;
 
-const SELECTORS = [
-'figure[typeof^=mw:Image]',
-'figure[typeof^=mw:Video]',
-'figure[typeof^=mw:Audio]',
-'span[typeof^=mw:Image]',
-'span[typeof^=mw:Video]',
-'span[typeof^=mw:Audio]',
-'figure-inline[typeof^=mw:Image]',
-'figure-inline[typeof^=mw:Video]',
-'figure-inline[typeof^=mw:Audio]',
-'span.IPA+small a[rel=mw:MediaLink]'
-];
 
 /**
  * A MediaWiki media type as represented in Parsoid HTML.
@@ -65,7 +54,7 @@
 function getMediaItemInfoFromPage(html) {
 const doc = domino.createDocument(html);
 // todo: handle Mathoid-rendered math images
-const selection = doc.querySelectorAll(SELECTORS.join(','));
+const selection = doc.querySelectorAll(MediaSelectors.join(','));
 return [].map.call(selection, (elem) => {
 const mediaType = getMediaType(elem);
 const resource = mediaType.selector && 
elem.querySelector(mediaType.selector);
@@ -217,7 +206,6 @@
 getMediaItemInfoFromPage,
 getMetadataFromApi,
 filterResult,
-SELECTORS,
 Image,
 Video,
 Audio
diff --git a/lib/selectors.js b/lib/selectors.js
new file mode 100644
index 000..b167c80
--- /dev/null
+++ b/lib/selectors.js
@@ -0,0 +1,25 @@
+'use strict';
+
+const MediaSelectors = [
+'figure[typeof^=mw:Image]',
+'figure[typeof^=mw:Video]',
+'figure[typeof^=mw:Audio]',
+'span[typeof^=mw:Image]',
+'span[typeof^=mw:Video]',
+'span[typeof^=mw:Audio]',
+'figure-inline[typeof^=mw:Image]',
+'figure-inline[typeof^=mw:Video]',
+'figure-inline[typeof^=mw:Audio]',
+'span.IPA+small a[rel=mw:MediaLink]'
+];
+
+const ImageSelectors = MediaSelectors.filter(selector => 
selector.includes('Image'));
+const VideoSelectors = MediaSelectors.filter(selector => 
selector.includes('Video'));
+const PronunciationSelector = MediaSelectors.filter(selector => 
selector.includes('IPA'));
+
+module.exports = {
+MediaSelectors,
+ImageSelectors,
+VideoSelectors,
+PronunciationSelector
+};
diff --git a/lib/transformations/anchorPopUpMediaTransforms.js 
b/lib/transformations/anchorPopUpMediaTransforms.js
index 89d3771..48fd92c 100644
--- a/lib/transformations/anchorPopUpMediaTransforms.js
+++ b/lib/transformations/anchorPopUpMediaTransforms.js
@@ -12,66 +12,24 @@
 
 'use strict';
 
-const NodeType = require('../nodeType');
-
-/**
- * Checks if a  element is an actual video.
- * Parsoid also uses  tags for audio files.
- * @return {boolean} true if real video
- */
-function isVideo(videoElem) {
-const MAX_LEVEL = 3;
-let node = videoElem.parentNode;
-for (let level = 0; level < MAX_LEVEL; level++) {
-if (!node) {
-return false;
-}
-
-// Look for an ancestor element 
-// or .
-if (node.nodeType === NodeType.ELEMENT_NODE
-&& (node.nodeName === 'FIGURE' ||
-node.nodeName === 'FIGURE-INLINE' ||
-// TODO:  is here for backwards compatibility.
-// This is now generated as  and should
-// be safe to remove when verion 1.5 content is no
-// longer acceptable.
-node.nodeName === 'SPAN')) {
-const typeOf = node.getAttribute('typeof');
-if (typeOf && typeOf.includes('mw:Video')) {
-return true;
-}
-}
-
-node = node.parentNode;
-}
-
-return false;
-}
+const VideoSelectors = require('../selectors').VideoSelectors;
 
 function fixVideoAnchor(content) {
-const videoElements = content.querySelectorAll('video');
-for (let i = 0; i < videoElements.length; i++) {
-const videoElem = videoElements[i];
-
-// T167183: Only handle videos
-if (!isVideo(videoElem)) {
-continue;
-}
-
+const videos = content.querySelectorAll(VideoSelectors.map(sel => 
sel.concat(' 

  1   2   3   4   5   6   7   8   9   10   >