Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13957983
D15093.id36436.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D15093.id36436.diff
View Options
diff --git a/resources/sql/autopatches/20160122.project.1.boarddefault.php b/resources/sql/autopatches/20160122.project.1.boarddefault.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20160122.project.1.boarddefault.php
@@ -0,0 +1,60 @@
+<?php
+
+// Populate the newish `hasWorkboard` column for projects with workboard.
+// Set the default menu item to "Workboard" for projects which used to have
+// that default.
+
+$project_table = new PhabricatorProject();
+$conn_w = $project_table->establishConnection('w');
+
+$panel_table = id(new PhabricatorProfilePanelConfiguration());
+$panel_conn = $panel_table->establishConnection('w');
+
+foreach (new LiskMigrationIterator($project_table) as $project) {
+ $columns = queryfx_all(
+ $conn_w,
+ 'SELECT * FROM %T WHERE projectPHID = %s',
+ id(new PhabricatorProjectColumn())->getTableName(),
+ $project->getPHID());
+
+ // This project has no columns, so we don't need to change anything.
+ if (!$columns) {
+ continue;
+ }
+
+ // This project has columns, so set its workboard flag.
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET hasWorkboard = 1 WHERE id = %d',
+ $project->getTableName(),
+ $project->getID());
+
+ // Try to set the default menu item to "Workboard".
+ $config = queryfx_all(
+ $panel_conn,
+ 'SELECT * FROM %T WHERE profilePHID = %s',
+ $panel_table->getTableName(),
+ $project->getPHID());
+
+ // There are already some settings, so don't touch them.
+ if ($config) {
+ continue;
+ }
+
+ queryfx(
+ $panel_conn,
+ 'INSERT INTO %T
+ (phid, profilePHID, panelKey, builtinKey, visibility, panelProperties,
+ panelOrder, dateCreated, dateModified)
+ VALUES (%s, %s, %s, %s, %s, %s, %d, %d, %d)',
+ $panel_table->getTableName(),
+ $panel_table->generatePHID(),
+ $project->getPHID(),
+ PhabricatorProjectWorkboardProfilePanel::PANELKEY,
+ PhabricatorProject::PANEL_WORKBOARD,
+ PhabricatorProfilePanelConfiguration::VISIBILITY_DEFAULT,
+ '{}',
+ 2,
+ PhabricatorTime::getNow(),
+ PhabricatorTime::getNow());
+}
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
@@ -57,6 +57,9 @@
->setProperties($import_column->getProperties())
->save();
}
+
+ $project->setHasWorkboard(1)->save();
+
$table->saveTransaction();
return id(new AphrontRedirectResponse())->setURI($board_uri);
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -776,6 +776,8 @@
->setProjectPHID($project->getPHID())
->save();
+ $project->setHasWorkboard(1)->save();
+
return id(new AphrontRedirectResponse())
->setURI($board_uri);
} else {
diff --git a/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php
--- a/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php
+++ b/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php
@@ -52,15 +52,7 @@
$project = $config->getProfileObject();
- $columns = id(new PhabricatorProjectColumnQuery())
- ->setViewer($viewer)
- ->withProjectPHIDs(array($project->getPHID()))
- ->execute();
- if ($columns) {
- $icon = 'fa-columns';
- } else {
- $icon = 'fa-columns grey';
- }
+ $has_workboard = $project->getHasWorkboard();
$id = $project->getID();
$href = "/project/board/{$id}/";
@@ -69,7 +61,8 @@
$item = $this->newItem()
->setHref($href)
->setName($name)
- ->setIcon($icon);
+ ->setDisabled(!$has_workboard)
+ ->setIcon('fa-columns');
return array(
$item,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 15 2024, 12:18 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712801
Default Alt Text
D15093.id36436.diff (4 KB)
Attached To
Mode
D15093: Migrate existing projects to retain "Workboard" as default item
Attached
Detach File
Event Timeline
Log In to Comment