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

Change subject: Accept original title in the wt2html direction
......................................................................


Accept original title in the wt2html direction

Change-Id: I8a44560ddb52adc174a7c4edb24bdd885a2901bb
---
M lib/api/routes.js
M tests/mocha/api.js
2 files changed, 33 insertions(+), 1 deletion(-)

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



diff --git a/lib/api/routes.js b/lib/api/routes.js
index 332a914..5d91d2a 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -101,6 +101,7 @@
                                res.locals.oldid = original.revid;
                        }
                        if (original.title) {
+                               res.locals.titleMissing = false;
                                res.locals.pageName = original.title;
                        }
                }
@@ -600,7 +601,6 @@
                                if (res.locals.titleMissing) {
                                        return apiUtils.fatalRequest(env, 'No 
title or wikitext was provided.', 400);
                                }
-
                                // We've been given source for this page
                                if (opts.original && opts.original.wikitext) {
                                        wikitext = opts.original.wikitext.body;
diff --git a/tests/mocha/api.js b/tests/mocha/api.js
index 654ea7a..4719a7c 100644
--- a/tests/mocha/api.js
+++ b/tests/mocha/api.js
@@ -296,6 +296,38 @@
                        .end(done);
                });
 
+               it('should accept an original title (html)', function(done) {
+                       request(api)
+                       .post(mockDomain + '/v3/transform/wikitext/to/html/')
+                       .send({
+                               original: {
+                                       title: 'Main_Page',
+                               },
+                       })
+                       .expect(302)  // no revid provided
+                       .expect(function(res) {
+                               res.headers.should.have.property('location');
+                               res.headers.location.should.equal('/' + 
mockDomain + '/v3/page/html/Main_Page/1');
+                       })
+                       .end(done);
+               });
+
+               it('should accept an original title (pagebundle)', 
function(done) {
+                       request(api)
+                       .post(mockDomain + 
'/v3/transform/wikitext/to/pagebundle/')
+                       .send({
+                               original: {
+                                       title: 'Main_Page',
+                               },
+                       })
+                       .expect(302)  // no revid provided
+                       .expect(function(res) {
+                               res.headers.should.have.property('location');
+                               res.headers.location.should.equal('/' + 
mockDomain + '/v3/page/pagebundle/Main_Page/1');
+                       })
+                       .end(done);
+               });
+
                it('should not require a title when empty wikitext is provided 
(html)', function(done) {
                        request(api)
                        .post(mockDomain + '/v3/transform/wikitext/to/html/')

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a44560ddb52adc174a7c4edb24bdd885a2901bb
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to