This small task is about keeping track of this TODO about getIsNewObject():
- So, we should at least mention this task from that source code line.
- Then, we should at least improve the getisNewObject() support since there are related bugs around (e.g. T16085) where that is not recognized even if the PHID is clearly null. Example improvement, so to avoid a $mark_as_create = false as default but have a $mark_as_create = $this->getIsNewObject() as default.
So, if the system already recognized that it's a new object, we should proceed with this information, without inspecting transactions (also faster):
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 861815b9d8..48f04939ef 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -1301,14 +1301,16 @@ abstract class PhabricatorApplicationTransactionEditor $this->applyInitialEffects($object, $xactions); } - // TODO: Once everything is on EditEngine, just use getIsNewObject() to - // figure this out instead. - $mark_as_create = false; - $create_type = PhabricatorTransactions::TYPE_CREATE; - foreach ($xactions as $xaction) { - if ($xaction->getTransactionType() == $create_type) { - $mark_as_create = true; - break; + $mark_as_create = $this->getIsNewObject(); + if (!$mark_as_create) { + // TODO: Once everything is on EditEngine, just use getIsNewObject() to + // figure this out instead. + $create_type = PhabricatorTransactions::TYPE_CREATE; + foreach ($xactions as $xaction) { + if ($xaction->getTransactionType() == $create_type) { + $mark_as_create = true; + break; + } } }
- As final step, we should have a task about migrating everything to PhabricatorApplicationTransactionEditor (and have that as parent task of this task), and point that task in that TODO (and we can close this).