jenkins-bot has submitted this change and it was merged.
Change subject: Publishing: Add link to source article in published edit summary
......................................................................
Publishing: Add link to source article in published edit summary
* Pulls revision from server and saves to mw.cx.sourceRevision
* Adds sourcerevision to api call
* Creates link for inclusion in edit summary.
Change-Id: I843ef4d1277c6eb1e39abbc9805ddc154fbb4270
---
M api/ApiContentTranslationPublish.php
M modules/base/ext.cx.model.js
M modules/source/ext.cx.source.js
M modules/translation/ext.cx.publish.js
4 files changed, 15 insertions(+), 2 deletions(-)
Approvals:
Santhosh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/api/ApiContentTranslationPublish.php
b/api/ApiContentTranslationPublish.php
index 59fb291..a9af054 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -45,9 +45,14 @@
}
protected function saveWikitext( $title, $wikitext, $params ) {
+ $sourceLink = '[[:' . $params['from']
+ . ':Special:Redirect/revision/'
+ . $params['sourcerevision']
+ . '|' . $params['sourcetitle'] . ']]';
+
$summary = $this->msg(
'cx-publish-summary',
- $params['sourcetitle']
+ $sourceLink
)->inContentLanguage()->text();
$apiParams = array(
@@ -141,6 +146,9 @@
'sourcetitle' => array(
ApiBase::PARAM_REQUIRED => true,
),
+ 'sourcerevision' => array(
+ ApiBase::PARAM_REQUIRED => true,
+ ),
'wpCaptchaId'=> null,
'wpCaptchaWord' => null,
);
@@ -170,6 +178,7 @@
'from' => 'The source language code.',
'to' => 'The target language code.',
'sourcetitle' => 'The title of the source page.',
+ 'sourcerevision' => 'The revision of the source page.',
'wpCaptchaId' => 'Captcha ID (when saving with a
captcha response).',
'wpCaptchaWord' => 'Answer to the captcha (when saving
with a captcha response).',
);
diff --git a/modules/base/ext.cx.model.js b/modules/base/ext.cx.model.js
index e6d3365..7eb807f 100644
--- a/modules/base/ext.cx.model.js
+++ b/modules/base/ext.cx.model.js
@@ -19,6 +19,8 @@
mw.cx.targetLanguage = null;
// Source title
mw.cx.sourceTitle = null;
+ // Source revision
+ mw.cx.sourceRevision = null;
// Translated title
mw.cx.targetTitle = null;
mw.cx.tools = {};
diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 184c679..bb6f889 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -56,6 +56,7 @@
$.get( fetchPageUrl )
.done( function ( response ) {
+ mw.cx.sourceRevision = response.revision;
mw.hook( 'mw.cx.source.loaded' ).fire( response
);
} ).fail( function ( xhr ) {
if ( xhr.status === 404 ) {
diff --git a/modules/translation/ext.cx.publish.js
b/modules/translation/ext.cx.publish.js
index e3081f8..328b1c7 100644
--- a/modules/translation/ext.cx.publish.js
+++ b/modules/translation/ext.cx.publish.js
@@ -96,7 +96,8 @@
html: content,
from: mw.cx.sourceLanguage,
to: mw.cx.targetLanguage,
- sourcetitle: sourceTitle
+ sourcetitle: sourceTitle,
+ sourcerevision: mw.cx.sourceRevision
};
if ( params ) {
--
To view, visit https://gerrit.wikimedia.org/r/159539
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I843ef4d1277c6eb1e39abbc9805ddc154fbb4270
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Jsahleen <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits