Page MenuHomePhabricator

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

Description

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.

They're:

page=Кашира&from=ru&to=ba&targettitle=Кашира&draft=36780
page=Foobar&from=en&to=sv&targettitle=Foobar&draft=35189

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.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 28 2015, 6:48 AM
Arrbee triaged this task as Normal 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.

Amire80 moved this task from Needs Triage to CX6 on the ContentTranslation board.Jul 2 2015, 5:05 PM

@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'] ) );
                }
santhosh claimed this task.Sep 29 2015, 4:03 AM
santhosh added a project: LE-CX6-Sprint 4.

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

https://gerrit.wikimedia.org/r/242053

santhosh moved this task from Backlog to In Review on the LE-CX6-Sprint break board.

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

https://gerrit.wikimedia.org/r/242053

santhosh moved this task from In Review to QA on the LE-CX6-Sprint break board.Sep 29 2015, 9:45 AM
Arrbee moved this task from QA to Done on the LE-CX6-Sprint break board.Sep 30 2015, 6:09 AM
Amire80 closed this task as Resolved.Oct 1 2015, 8:51 PM

Awesome, thank you.