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

Change subject: Fix useSelser in the http api
......................................................................


Fix useSelser in the http api

 * Reverts some of cbc3d196a52a1f0be69efb503d640b472f9cde7c

Change-Id: I20a0b24b765332fe176465e74c422a4c256b4685
---
M lib/api/routes.js
1 file changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/api/routes.js b/lib/api/routes.js
index f11aa70..92fbad5 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -559,10 +559,6 @@
                var startTimers = new Map();
 
                env.page.reset();
-               // As per 
https://www.mediawiki.org/wiki/Parsoid/API#v1_API_entry_points
-               //   "Both it and the oldid parameter are needed for
-               //    clean round-tripping of HTML retrieved earlier with"
-               // So, no oldid => no selser
                env.page.meta.revision.revid = res.locals.oldid;
 
                env.bumpSerializerResourceUse('htmlSize', html.length);
@@ -657,7 +653,14 @@
                        }
                }
 
-               return DU.serializeDOM(env, doc.body, 
env.conf.parsoid.useSelser)
+               // As per 
https://www.mediawiki.org/wiki/Parsoid/API#v1_API_entry_points
+               //   "Both it and the oldid parameter are needed for
+               //    clean round-tripping of HTML retrieved earlier with"
+               // So, no oldid => no selser
+               var hasOldId = !!env.page.meta.revision.revid;
+               var useSelser = hasOldId && env.conf.parsoid.useSelser;
+
+               return DU.serializeDOM(env, doc.body, useSelser)
                // .timeout(REQ_TIMEOUT)
                .then(function(output) {
                        if (metrics) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I20a0b24b765332fe176465e74c422a4c256b4685
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to