Santhosh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/188025
Change subject: Category text construction refactoring
......................................................................
Category text construction refactoring
Avoid the duplication of construction of actual categories and
high MT category by using all of them in an array. Also
avoid the problem of some categories going to <nowiki> and high MT
without <nowiki>
Change-Id: Iab2bfaaf093e9457a6b6acadb174b5e90c849846
---
M api/ApiContentTranslationPublish.php
1 file changed, 13 insertions(+), 12 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/25/188025/1
diff --git a/api/ApiContentTranslationPublish.php
b/api/ApiContentTranslationPublish.php
index 4d2263f..a5fb3d8 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -45,6 +45,7 @@
protected function saveWikitext( $title, $wikitext, $params ) {
global $wgContentTranslationHighMTCategory;
+ $categories = array();
$sourceLink = '[[:' . $params['from']
. ':Special:Redirect/revision/'
@@ -53,18 +54,7 @@
if ( $params['categories'] ) {
$categories = explode( '|', $params['categories'] );
- foreach ( $categories as $categoryTitle ) {
- $categoryText .= "\n[[" . $categoryTitle . "]]";
- }
}
-
- // If publishing to User namespace, wrap categories in <nowiki>
- // to avoid blocks by abuse filter. See T88007.
- if ( isset( $categoryText ) && $title->inNamespace( NS_USER ) )
{
- $categoryText = "<nowiki>" . $categoryText .
"\n</nowiki>";
- }
-
- $wikitext .= $categoryText;
$progress = json_decode( $params['progress'], true );
if (
@@ -72,9 +62,20 @@
$wgContentTranslationHighMTCategory &&
$this->hasHighMT( $progress )
) {
- $wikitext .= "\n[[" .
$wgContentTranslationHighMTCategory . ']]';
+ $categories[] = $wgContentTranslationHighMTCategory;
}
+ foreach ( $categories as $categoryTitle ) {
+ $categoryText .= "\n[[" . $categoryTitle . "]]";
+ }
+
+ // If publishing to User namespace, wrap categories in <nowiki>
+ // to avoid blocks by abuse filter. See T88007.
+ if ( isset( $categoryText ) && $title->inNamespace( NS_USER ) )
{
+ $categoryText = "<nowiki>" . $categoryText .
"\n</nowiki>";
+ }
+ $wikitext .= $categoryText;
+
$summary = $this->msg(
'cx-publish-summary',
$sourceLink
--
To view, visit https://gerrit.wikimedia.org/r/188025
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab2bfaaf093e9457a6b6acadb174b5e90c849846
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits