Page MenuHomePhabricator

Can't delete/discard in-progress translation (Draft)
Closed, ResolvedPublic


My dashboard has two in-progress translation, which I can't discard/delete. There is no error message while deleting them and they just stays forever. One of them was opened by @Amire80 and deleted successfully, while I can't do.



Event Timeline

KartikMistry raised the priority of this task from to Needs Triage.
KartikMistry updated the task description. (Show Details)
KartikMistry added subscribers: KartikMistry, Amire80.
Arrbee triaged this task as Medium priority.Apr 30 2015, 9:28 AM
Arrbee added a subscriber: Arrbee.
Amire80 set Security to None.

Is it still happening?

I suppose that you managed to delete the first one (Кашира), but the second one fails.

@Nikerabbit can't delete [[Róisín Murphy]].

I can't delete [[Gestapo]] (en->es) and [[Garvan Point]] (nn->no). I created both to test bugs :/

The issue here is, while testing some issues, same title will be used by more than one person. Ofcourse the second person use that title only after the translator either discard or publish the title. The delete API check the 'translation_started_by' field to verify the translation belong to the user trying to delete it. That will fail in the case of second translator and cannot delete the translation.

The fix I have in mind is:

diff --git a/api/ApiContentTranslationDelete.php b/api/ApiContentTranslationDelete.php
index d8a0da2..75ffdbe 100644
--- a/api/ApiContentTranslationDelete.php
+++ b/api/ApiContentTranslationDelete.php
@@ -25,7 +25,7 @@ class ApiContentTranslationDelete extends ApiBase {
                $translation = $translation->translation;
                $translationId = $translation['id'];
                if ( $translationId === null ||
-                       $translator->getGlobalUserId() !== intval( $translation['startedTranslator'] ) ) {
+                       $translator->getGlobalUserId() !== intval( $translation['lastUpdatedTranslator'] ) ) {
                        // Translation does not exist or belong to another translator
                        $this->dieUsageMsg( array( 'invalidtitle', $params['sourcetitle'] ) );

Change 242053 had a related patch set uploaded (by Santhosh):
Discard draft: Validate against last updated translator

Change 242053 merged by jenkins-bot:
Discard draft: Validate against last updated translator

Awesome, thank you.