Fix some minor issues with Maniphest file/attachment handling
Summary: @danielraffel is reporting an issue with file attachments which I can't reproduce, but I did find a couple of minor things. - Elsewhere, we store array() as the value of these PHID dictionaries (the idea being that we might store metadata there some day). While we may or may not do this, we should at least be consistent. - When you edit a task, there's a file upload control but it doesn't actually do anything. Just don't show it, there's no real reason to have it there. Test Plan: Created a new task with attached files, verified they encoded as "[]" instead of "true" in the database. Edited a task and didn't get a file control. Reviewers: jungejason, nh, tuomaspelkonen, aran Reviewed By: aran CC: danielraffel, aran Differential Revision: 1003
This commit is contained in:
@@ -176,7 +176,7 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||
|
||||
if ($files) {
|
||||
$file_map = mpull($files, 'getPHID');
|
||||
$file_map = array_fill_keys($file_map, true);
|
||||
$file_map = array_fill_keys($file_map, array());
|
||||
$changes[ManiphestTransactionType::TYPE_ATTACH] = array(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_FILE => $file_map,
|
||||
);
|
||||
@@ -234,7 +234,7 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||
// NOTE: It's safe to simply apply this transaction without doing
|
||||
// cycle detection because we know the new task has no children.
|
||||
$new_value = $parent_task->getAttached();
|
||||
$new_value[$type_task][$task->getPHID()] = true;
|
||||
$new_value[$type_task][$task->getPHID()] = array();
|
||||
|
||||
$parent_xaction = clone $template;
|
||||
$attach_type = ManiphestTransactionType::TYPE_ATTACH;
|
||||
@@ -475,13 +475,19 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||
->setLabel('Description')
|
||||
->setName('description')
|
||||
->setCaption($email_hint)
|
||||
->setValue($task->getDescription()))
|
||||
->appendChild(
|
||||
id(new AphrontFormDragAndDropUploadControl())
|
||||
->setLabel('Attached Files')
|
||||
->setName('files')
|
||||
->setDragAndDropTarget($panel_id)
|
||||
->setActivatedClass('aphront-panel-view-drag-and-drop'))
|
||||
->setValue($task->getDescription()));
|
||||
|
||||
if (!$task->getID()) {
|
||||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormDragAndDropUploadControl())
|
||||
->setLabel('Attached Files')
|
||||
->setName('files')
|
||||
->setDragAndDropTarget($panel_id)
|
||||
->setActivatedClass('aphront-panel-view-drag-and-drop'));
|
||||
}
|
||||
|
||||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->addCancelButton($cancel_uri)
|
||||
|
||||
Reference in New Issue
Block a user