Santhosh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/269600
Change subject: Do not delete the translation which was once published
......................................................................
Do not delete the translation which was once published
If the translation in progress was once published, deleting it should move
it to published status.
There is no UX change. If the translator deletes it from 'In progress'
dashboard, it get deleted as usual, but clicking 'Published' tab
in dashboard will show it there.
Bug: T123902
Change-Id: Icfa258cb7f35805a8c93a6acb3860fc2c6002a7e
---
M api/ApiContentTranslationDelete.php
1 file changed, 13 insertions(+), 6 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/00/269600/1
diff --git a/api/ApiContentTranslationDelete.php
b/api/ApiContentTranslationDelete.php
index 337f9d5..ae22595 100644
--- a/api/ApiContentTranslationDelete.php
+++ b/api/ApiContentTranslationDelete.php
@@ -22,16 +22,23 @@
$params['to'],
$params['sourcetitle']
);
- $translation = $translation->translation;
- $translationId = $translation['id'];
+
+ $translationId = $translation->translation['id'];
if ( $translationId === null ||
- $translator->getGlobalUserId() !== intval(
$translation['lastUpdatedTranslator'] ) ) {
+ $translator->getGlobalUserId() !== intval(
$translation->translation['lastUpdatedTranslator'] ) ) {
// Translation does not exist or belong to another
translator
$this->dieUsageMsg( array( 'invalidtitle',
$params['sourcetitle'] ) );
}
- ContentTranslation\Translator::removeTranslation(
$translationId );
- ContentTranslation\Translation::delete( $translationId );
- ContentTranslation\Draft::delete( $translationId );
+
+ if ( $translation->translation['targetURL'] !== null ) {
+ // Translation was once published. Don't delete, move
it to published status.
+ $translation->translation['status'] = 'published';
+ $translation->update();
+ } else {
+ ContentTranslation\Translator::removeTranslation(
$translationId );
+ ContentTranslation\Translation::delete( $translationId
);
+ ContentTranslation\Draft::delete( $translationId );
+ }
$result = array(
'result' => 'success'
);
--
To view, visit https://gerrit.wikimedia.org/r/269600
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfa258cb7f35805a8c93a6acb3860fc2c6002a7e
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