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

Change subject: Use topicId instead of page name for posts in the APIHandler
......................................................................


Use topicId instead of page name for posts in the APIHandler

Change-Id: If8458719ec59cc8f538dbb36cd79cf17fb8435ef
---
M modules/flow/dm/api/mw.flow.dm.APIHandler.js
M modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
2 files changed, 16 insertions(+), 6 deletions(-)

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



diff --git a/modules/flow/dm/api/mw.flow.dm.APIHandler.js 
b/modules/flow/dm/api/mw.flow.dm.APIHandler.js
index 0011d32..c4939d0 100644
--- a/modules/flow/dm/api/mw.flow.dm.APIHandler.js
+++ b/modules/flow/dm/api/mw.flow.dm.APIHandler.js
@@ -127,6 +127,16 @@
        };
 
        /**
+        * Get topic title from topic id
+        *
+        * @param {string} topicId Topic id
+        * @return {string} Topic title
+        */
+       mw.flow.dm.APIHandler.prototype.getTopicTitle = function ( topicId ) {
+               return ( new mw.Title( topicId, 2600 ) ).getPrefixedDb();
+       };
+
+       /**
         * Send an edit request to the API to save a reply.
         *
         * @param {string} topicId Topic Id
@@ -235,9 +245,9 @@
         * @param {string} format
         * @return {jQuery.Promise} Promise that is resolved with the post 
revision data
         */
-       mw.flow.dm.APIHandler.prototype.getPost = function ( postId, format ) {
+       mw.flow.dm.APIHandler.prototype.getPost = function ( topicId, postId, 
format ) {
                var params = {
-                       page: this.page,
+                       page: this.getTopicTitle( topicId ),
                        vppostId: postId,
                        vpformat: format || 'html'
                };
@@ -257,10 +267,10 @@
         * @param {string} [captcha] CAPTCHA information
         * @return {jQuery.Promise} Promise that is resolved with the saved 
post revision id
         */
-       mw.flow.dm.APIHandler.prototype.savePost = function ( postId, content, 
format, captcha ) {
+       mw.flow.dm.APIHandler.prototype.savePost = function ( topicId, postId, 
content, format, captcha ) {
                var xhr,
                        params = {
-                               page: this.page,
+                               page: this.getTopicTitle( topicId ),
                                epcontent: content,
                                epformat: format,
                                epprev_revision: this.currentRevision,
diff --git a/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js 
b/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
index 1352e85..656d35b 100644
--- a/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
+++ b/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
@@ -58,7 +58,7 @@
                var widget = this,
                        contentFormat = this.editor.getContentFormat();
 
-               this.api.getPost( postId, contentFormat ).then(
+               this.api.getPost( topicId, postId, contentFormat ).then(
                        function ( post ) {
                                var content = OO.getProp( post, 'content', 
'content' ),
                                        format = OO.getProp( post, 'content', 
'format' );
@@ -129,7 +129,7 @@
                this.error.toggle( false );
 
                this.editor.pushPending();
-               this.api.savePost( this.postId, content, format, captcha )
+               this.api.savePost( this.topicId, this.postId, content, format, 
captcha )
                        .then( function ( workflow ) {
                                widget.emit( 'saveContent', workflow, content, 
format );
                        } )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If8458719ec59cc8f538dbb36cd79cf17fb8435ef
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Sbisson <sbis...@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