1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-22 03:29:11 +01:00

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
This commit is contained in:
epriestley 2020-05-04 13:43:10 -07:00
parent 3a76248071
commit 7fa47408a3

View file

@ -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);
}
}