From 7fa47408a3c565d8eed586743819ca5a1b6a698b Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 4 May 2020 13:43:10 -0700 Subject: [PATCH] When a user submits "isEditing" inlines and chooses to publish them, publish their current draft state as-shown Summary: Ref T13513. When users choose to publish inlines, we want to publish the visible text, not the last "checkpointed" state. Test Plan: - Created an inline ("AAA"). - Edited it into "BBB", did not save. - Submitted. - Confirmed that I want to publish the unsaved inline. - Saw "BBB" publish. Maniphest Tasks: T13513 Differential Revision: https://secure.phabricator.com/D21218 --- .../query/DifferentialTransactionQuery.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/applications/differential/query/DifferentialTransactionQuery.php b/src/applications/differential/query/DifferentialTransactionQuery.php index 40a2d30ce8..e8a7316ea3 100644 --- a/src/applications/differential/query/DifferentialTransactionQuery.php +++ b/src/applications/differential/query/DifferentialTransactionQuery.php @@ -33,6 +33,17 @@ final class DifferentialTransactionQuery foreach ($inlines as $key => $inline) { if ($inline->isVoidComment($viewer)) { unset($inlines[$key]); + continue; + } + + // For other inlines: if they have a nonempty draft state, set their + // content to the draft state content. We want to submit the comment + // as it is currently shown to the user, not as it was stored the last + // time they clicked "Save". + + $draft_content = $inline->getContentForEdit($viewer); + if (strlen($draft_content)) { + $inline->setContent($draft_content); } }