Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editengine/PhabricatorEditEngine.php
| Show First 20 Lines • Show All 1,043 Lines • ▼ Show 20 Lines | private function buildCommentResponse($object) { | ||||
| $xactions = array(); | $xactions = array(); | ||||
| $actions = $request->getStr('editengine.actions'); | $actions = $request->getStr('editengine.actions'); | ||||
| if ($actions) { | if ($actions) { | ||||
| $type_map = array(); | $type_map = array(); | ||||
| foreach ($fields as $field) { | foreach ($fields as $field) { | ||||
| $types = $field->getCommentEditTypes(); | $types = $field->getCommentEditTypes(); | ||||
| foreach ($types as $type) { | foreach ($types as $type) { | ||||
| $type_map[$type->getEditType()] = $type; | $type_map[$type->getEditType()] = array( | ||||
| 'type' => $type, | |||||
| 'field' => $field, | |||||
| ); | |||||
| } | } | ||||
| } | } | ||||
| $actions = phutil_json_decode($actions); | $actions = phutil_json_decode($actions); | ||||
| foreach ($actions as $action) { | foreach ($actions as $action) { | ||||
| $type = idx($action, 'type'); | $type = idx($action, 'type'); | ||||
| if (!$type) { | if (!$type) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $edit_type = idx($type_map, $type); | $spec = idx($type_map, $type); | ||||
| if (!$edit_type) { | if (!$spec) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $edit_type = $spec['type']; | |||||
| $field = $spec['field']; | |||||
| $field->readValueFromComment($action); | |||||
| $type_xactions = $edit_type->generateTransactions( | $type_xactions = $edit_type->generateTransactions( | ||||
| $template, | $template, | ||||
| array( | array( | ||||
| 'value' => idx($action, 'value'), | 'value' => $field->getValueForTransaction(), | ||||
| )); | )); | ||||
| foreach ($type_xactions as $type_xaction) { | foreach ($type_xactions as $type_xaction) { | ||||
| $xactions[] = $type_xaction; | $xactions[] = $type_xaction; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (strlen($comment_text) || !$xactions) { | if (strlen($comment_text) || !$xactions) { | ||||
| ▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines | |||||