Page MenuHomePhabricator

D19978.id47716.diff
No OneTemporary

D19978.id47716.diff

diff --git a/src/applications/project/controller/PhabricatorProjectBoardImportController.php b/src/applications/project/controller/PhabricatorProjectBoardImportController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardImportController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardImportController.php
@@ -21,17 +21,28 @@
}
$this->setProject($project);
+ $project_id = $project->getID();
+ $board_uri = $this->getApplicationURI("board/{$project_id}/");
+
+ // See PHI1025. We only want to prevent the import if the board already has
+ // real columns. If it has proxy columns (for example, for milestones) you
+ // can still import columns from another board.
$columns = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
->withProjectPHIDs(array($project->getPHID()))
+ ->withIsProxyColumn(false)
->execute();
if ($columns) {
- return new Aphront400Response();
+ return $this->newDialog()
+ ->setTitle(pht('Workboard Already Has Columns'))
+ ->appendParagraph(
+ pht(
+ 'You can not import columns into this workboard because it '.
+ 'already has columns. You can only import into an empty '.
+ 'workboard.'))
+ ->addCancelButton($board_uri);
}
- $project_id = $project->getID();
- $board_uri = $this->getApplicationURI("board/{$project_id}/");
-
if ($request->isFormPost()) {
$import_phid = $request->getArr('importProjectPHID');
$import_phid = reset($import_phid);
@@ -39,9 +50,16 @@
$import_columns = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
->withProjectPHIDs(array($import_phid))
+ ->withIsProxyColumn(false)
->execute();
if (!$import_columns) {
- return new Aphront400Response();
+ return $this->newDialog()
+ ->setTitle(pht('Source Workboard Has No Columns'))
+ ->appendParagraph(
+ pht(
+ 'You can not import columns from that workboard because it has '.
+ 'no importable columns.'))
+ ->addCancelButton($board_uri);
}
$table = id(new PhabricatorProjectColumn())
@@ -50,9 +68,6 @@
if ($import_column->isHidden()) {
continue;
}
- if ($import_column->getProxy()) {
- continue;
- }
$new_column = PhabricatorProjectColumn::initializeNewColumn($viewer)
->setSequence($import_column->getSequence())
diff --git a/src/applications/project/query/PhabricatorProjectColumnQuery.php b/src/applications/project/query/PhabricatorProjectColumnQuery.php
--- a/src/applications/project/query/PhabricatorProjectColumnQuery.php
+++ b/src/applications/project/query/PhabricatorProjectColumnQuery.php
@@ -8,6 +8,7 @@
private $projectPHIDs;
private $proxyPHIDs;
private $statuses;
+ private $isProxyColumn;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -34,6 +35,11 @@
return $this;
}
+ public function withIsProxyColumn($is_proxy) {
+ $this->isProxyColumn = $is_proxy;
+ return $this;
+ }
+
public function newResultObject() {
return new PhabricatorProjectColumn();
}
@@ -156,6 +162,14 @@
$this->statuses);
}
+ if ($this->isProxyColumn !== null) {
+ if ($this->isProxyColumn) {
+ $where[] = qsprintf($conn, 'proxyPHID IS NOT NULL');
+ } else {
+ $where[] = qsprintf($conn, 'proxyPHID IS NULL');
+ }
+ }
+
return $where;
}
diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
--- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php
+++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
@@ -53,6 +53,7 @@
$columns = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
->withProjectPHIDs(array_keys($projs))
+ ->withIsProxyColumn(false)
->execute();
$has_cols = mgroup($columns, 'getProjectPHID');
} else {

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 6:57 PM (1 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715885
Default Alt Text
D19978.id47716.diff (4 KB)

Event Timeline