@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Migrate existing projects to retain "Workboard" as default item

Summary:
Ref T10054. Ref T6961.

- Existing projects with workboards had "Workboard" as the default menu item. Retain this behavior.
- Populate the recently-added `hasWorkboard` flag so we can do a couple of things a little faster (see T6961).

Test Plan:
- Ran migration.
- Verified a bunch of projects looked sensible/correct after the migration.
- Created a workboard, verified `hasWorkboard` got set properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T6961, T10054

Differential Revision: https://secure.phabricator.com/D15093

+68 -10
+60
resources/sql/autopatches/20160122.project.1.boarddefault.php
··· 1 + <?php 2 + 3 + // Populate the newish `hasWorkboard` column for projects with workboard. 4 + // Set the default menu item to "Workboard" for projects which used to have 5 + // that default. 6 + 7 + $project_table = new PhabricatorProject(); 8 + $conn_w = $project_table->establishConnection('w'); 9 + 10 + $panel_table = id(new PhabricatorProfilePanelConfiguration()); 11 + $panel_conn = $panel_table->establishConnection('w'); 12 + 13 + foreach (new LiskMigrationIterator($project_table) as $project) { 14 + $columns = queryfx_all( 15 + $conn_w, 16 + 'SELECT * FROM %T WHERE projectPHID = %s', 17 + id(new PhabricatorProjectColumn())->getTableName(), 18 + $project->getPHID()); 19 + 20 + // This project has no columns, so we don't need to change anything. 21 + if (!$columns) { 22 + continue; 23 + } 24 + 25 + // This project has columns, so set its workboard flag. 26 + queryfx( 27 + $conn_w, 28 + 'UPDATE %T SET hasWorkboard = 1 WHERE id = %d', 29 + $project->getTableName(), 30 + $project->getID()); 31 + 32 + // Try to set the default menu item to "Workboard". 33 + $config = queryfx_all( 34 + $panel_conn, 35 + 'SELECT * FROM %T WHERE profilePHID = %s', 36 + $panel_table->getTableName(), 37 + $project->getPHID()); 38 + 39 + // There are already some settings, so don't touch them. 40 + if ($config) { 41 + continue; 42 + } 43 + 44 + queryfx( 45 + $panel_conn, 46 + 'INSERT INTO %T 47 + (phid, profilePHID, panelKey, builtinKey, visibility, panelProperties, 48 + panelOrder, dateCreated, dateModified) 49 + VALUES (%s, %s, %s, %s, %s, %s, %d, %d, %d)', 50 + $panel_table->getTableName(), 51 + $panel_table->generatePHID(), 52 + $project->getPHID(), 53 + PhabricatorProjectWorkboardProfilePanel::PANELKEY, 54 + PhabricatorProject::PANEL_WORKBOARD, 55 + PhabricatorProfilePanelConfiguration::VISIBILITY_DEFAULT, 56 + '{}', 57 + 2, 58 + PhabricatorTime::getNow(), 59 + PhabricatorTime::getNow()); 60 + }
+3
src/applications/project/controller/PhabricatorProjectBoardImportController.php
··· 57 57 ->setProperties($import_column->getProperties()) 58 58 ->save(); 59 59 } 60 + 61 + $project->setHasWorkboard(1)->save(); 62 + 60 63 $table->saveTransaction(); 61 64 62 65 return id(new AphrontRedirectResponse())->setURI($board_uri);
+2
src/applications/project/controller/PhabricatorProjectBoardViewController.php
··· 769 769 ->setProjectPHID($project->getPHID()) 770 770 ->save(); 771 771 772 + $project->setHasWorkboard(1)->save(); 773 + 772 774 return id(new AphrontRedirectResponse()) 773 775 ->setURI($board_uri); 774 776 case 'import':
+3 -10
src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php
··· 52 52 53 53 $project = $config->getProfileObject(); 54 54 55 - $columns = id(new PhabricatorProjectColumnQuery()) 56 - ->setViewer($viewer) 57 - ->withProjectPHIDs(array($project->getPHID())) 58 - ->execute(); 59 - if ($columns) { 60 - $icon = 'fa-columns'; 61 - } else { 62 - $icon = 'fa-columns grey'; 63 - } 55 + $has_workboard = $project->getHasWorkboard(); 64 56 65 57 $id = $project->getID(); 66 58 $href = "/project/board/{$id}/"; ··· 69 61 $item = $this->newItem() 70 62 ->setHref($href) 71 63 ->setName($name) 72 - ->setIcon($icon); 64 + ->setDisabled(!$has_workboard) 65 + ->setIcon('fa-columns'); 73 66 74 67 return array( 75 68 $item,