Nikerabbit has submitted this change and it was merged.
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, 15 insertions(+), 7 deletions(-)
Approvals:
Nikerabbit: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/api/ApiContentTranslationDelete.php
b/api/ApiContentTranslationDelete.php
index 337f9d5..dcbe0b2 100644
--- a/api/ApiContentTranslationDelete.php
+++ b/api/ApiContentTranslationDelete.php
@@ -22,16 +22,24 @@
$params['to'],
$params['sourcetitle']
);
- $translation = $translation->translation;
- $translationId = $translation['id'];
+
+ $translationId = $translation->translation['id'];
if ( $translationId === null ||
- $translator->getGlobalUserId() !== intval(
$translation['lastUpdatedTranslator'] ) ) {
- // Translation does not exist or belong to another
translator
+ $translator->getGlobalUserId() !== intval(
$translation->translation['lastUpdatedTranslator'] )
+ ) {
+ // Translation does not exist or it belongs 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: merged
Gerrit-Change-Id: Icfa258cb7f35805a8c93a6acb3860fc2c6002a7e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits