Mholloway has uploaded a new change for review.

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

Change subject: Remove removePictureCaptionIfPresent() from feed/news.js
......................................................................

Remove removePictureCaptionIfPresent() from feed/news.js

This should be handled on the client.

Change-Id: I295c01b48a0d4feea6b21e07e85179deadf1f216
---
M lib/feed/news.js
M test/features/news/news.js
2 files changed, 0 insertions(+), 27 deletions(-)


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

diff --git a/lib/feed/news.js b/lib/feed/news.js
index d623f59..fd1b9ec 100644
--- a/lib/feed/news.js
+++ b/lib/feed/news.js
@@ -7,22 +7,6 @@
 var parsoid = require('../parsoid-access');
 var HTTPError = require('../util').HTTPError;
 
-// Remove section thumbnail caption which will likely be incorrect
-// in the app's presentation.
-function removePictureCaptionIfPresent(str, itals) {
-    for (var k = 0, l = itals.length; k < l; k++) {
-        var ital = itals[k],
-            html = ital.innerHTML,
-            length = html.length;
-
-        if (html.charAt(0) === '(' && html.charAt(length-1) === ')') {
-            let start = str.indexOf(ital.outerHTML),
-                end = start + ital.outerHTML.length;
-            return mUtil.spliceString(str, start, end);
-        }
-    }
-    return str;
-}
 
 function promise(app, req, dontThrow) {
     if (req.params.domain.indexOf('en.') !== 0) {
@@ -65,9 +49,6 @@
                 linkTitles.push(title);
             }
 
-            stories[j].innerHTML = 
removePictureCaptionIfPresent(stories[j].innerHTML,
-                  stories[j].getElementsByTagName('i'));
-
             story.story = stories[j].innerHTML;
             result.payload.push(story);
         }
@@ -106,7 +87,4 @@
 
 module.exports = {
     promise: promise,
-
-    //visible for testing
-    removePictureCaptionIfPresent: removePictureCaptionIfPresent
 };
\ No newline at end of file
diff --git a/test/features/news/news.js b/test/features/news/news.js
index adabc7f..4c10224 100644
--- a/test/features/news/news.js
+++ b/test/features/news/news.js
@@ -5,7 +5,6 @@
 var assert = require('../../utils/assert');
 var server = require('../../utils/server');
 var headers = require('../../utils/headers');
-var news = require('../../../lib/feed/news');
 var constants = require('./constants');
 
 
@@ -45,8 +44,4 @@
               });
           });
     });
-    it('Picture caption stripping should behave as expected', function() {
-        
assert.deepEqual(news.removePictureCaptionIfPresent(constants.newsHtml1, 
toElement(constants.newsHtml1).getElementsByTagName('i')), 
constants.cleanNewsHtml1);
-        
assert.deepEqual(news.removePictureCaptionIfPresent(constants.newsHtml2, 
toElement(constants.newsHtml2).getElementsByTagName('i')), 
constants.cleanNewsHtml2);
-    })
 });
\ No newline at end of file

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

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

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

Reply via email to