@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.

Allow the workboard backlog column to be reordered

Summary:
Fixes T5677.

- Instead of using `sequence == 0` to mean "this is the backlog column", flag the column explicitly.
- Migrate existing sequence 0 columns to have the flag.
- Add the flag when initializing or copying a board.
- Remove special backlog logic when reordering columns.

Test Plan:
- Migrated columns, viewed some boards, they looked identical.
- Reordered the backlog column a bunch of times (first, last, middle, dragged other stuff around).
- Added tasks to a project, saw them show up in the reordered backlog.
- Initialized a new board and saw a backlog column show up.
- Copied an existing board and saw the backlog column come over.
- Tried to hide a backlog column.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5677

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

+56 -27
+2
resources/sql/autopatches/20140808.boardprop.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_project.project_column 2 + ADD properties LONGTEXT NOT NULL COLLATE utf8_bin;
+2
resources/sql/autopatches/20140808.boardprop.2.sql
··· 1 + UPDATE {$NAMESPACE}_project.project_column 2 + SET properties = '{}' WHERE properties = '';
+24
resources/sql/autopatches/20140808.boardprop.3.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorProjectColumn(); 4 + $conn_w = $table->establishConnection('w'); 5 + 6 + foreach (new LiskMigrationIterator($table) as $column) { 7 + $id = $column->getID(); 8 + 9 + echo "Adjusting column {$id}...\n"; 10 + if ($column->getSequence() == 0) { 11 + 12 + $properties = $column->getProperties(); 13 + $properties['isDefault'] = true; 14 + 15 + queryfx( 16 + $conn_w, 17 + 'UPDATE %T SET properties = %s WHERE id = %d', 18 + $table->getTableName(), 19 + json_encode($properties), 20 + $id); 21 + } 22 + } 23 + 24 + echo "Done.\n";
+1
src/applications/project/controller/PhabricatorProjectBoardImportController.php
··· 60 60 ->setSequence($import_column->getSequence()) 61 61 ->setProjectPHID($project->getPHID()) 62 62 ->setName($import_column->getName()) 63 + ->setProperties($import_column->getProperties()) 63 64 ->save(); 64 65 } 65 66 $table->saveTransaction();
+10 -25
src/applications/project/controller/PhabricatorProjectBoardReorderController.php
··· 54 54 return new Aphront404Response(); 55 55 } 56 56 57 - // TODO: We could let you move the backlog column around if you really 58 - // want, but for now we use sequence position 0 as magic. 59 57 $target_column = $columns[$column_phid]; 60 58 $new_sequence = $request->getInt('sequence'); 61 - if ($target_column->isDefaultColumn() || $new_sequence < 1) { 59 + if ($new_sequence < 0) { 62 60 return new Aphront404Response(); 63 61 } 64 62 ··· 101 99 102 100 $list_id = celerity_generate_unique_node_id(); 103 101 104 - $static_list = id(new PHUIObjectItemListView()) 105 - ->setUser($viewer) 106 - ->setFlush(true) 107 - ->setStackable(true); 108 - 109 102 $list = id(new PHUIObjectItemListView()) 110 103 ->setUser($viewer) 111 104 ->setID($list_id) ··· 120 113 $item->setDisabled(true); 121 114 } 122 115 123 - if ($column->isDefaultColumn()) { 124 - $item->setDisabled(true); 125 - $static_list->addItem($item); 126 - } else { 127 - $item->setGrippable(true); 128 - $item->addSigil('board-column'); 129 - $item->setMetadata( 130 - array( 131 - 'columnPHID' => $column->getPHID(), 132 - 'columnSequence' => $column->getSequence(), 133 - )); 116 + $item->setGrippable(true); 117 + $item->addSigil('board-column'); 118 + $item->setMetadata( 119 + array( 120 + 'columnPHID' => $column->getPHID(), 121 + 'columnSequence' => $column->getSequence(), 122 + )); 134 123 135 - $list->addItem($item); 136 - } 137 - 124 + $list->addItem($item); 138 125 } 139 126 140 127 Javelin::initBehavior( ··· 147 134 return $this->newDialog() 148 135 ->setTitle(pht('Reorder Columns')) 149 136 ->setWidth(AphrontDialogView::WIDTH_FORM) 150 - ->appendParagraph(pht('This column can not be moved:')) 151 - ->appendChild($static_list) 152 - ->appendParagraph(pht('Drag and drop these columns to reorder them:')) 137 + ->appendParagraph(pht('Drag and drop columns to reorder them.')) 153 138 ->appendChild($list) 154 139 ->addSubmitButton(pht('Done')); 155 140 }
+1
src/applications/project/controller/PhabricatorProjectBoardViewController.php
··· 74 74 $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); 75 75 $column = PhabricatorProjectColumn::initializeNewColumn($viewer) 76 76 ->setSequence(0) 77 + ->setProperty('isDefault', true) 77 78 ->setProjectPHID($project->getPHID()) 78 79 ->save(); 79 80 $column->attachProject($project);
+15 -1
src/applications/project/storage/PhabricatorProjectColumn.php
··· 17 17 protected $status; 18 18 protected $projectPHID; 19 19 protected $sequence; 20 + protected $properties = array(); 20 21 21 22 private $project = self::ATTACHABLE; 22 23 ··· 29 30 public function getConfiguration() { 30 31 return array( 31 32 self::CONFIG_AUX_PHID => true, 33 + self::CONFIG_SERIALIZATION => array( 34 + 'properties' => self::SERIALIZATION_JSON, 35 + ), 32 36 ) + parent::getConfiguration(); 33 37 } 34 38 ··· 47 51 } 48 52 49 53 public function isDefaultColumn() { 50 - return ($this->getSequence() == 0); 54 + return (bool)$this->getProperty('isDefault'); 51 55 } 52 56 53 57 public function isHidden() { ··· 75 79 if ($this->isDefaultColumn()) { 76 80 return PHUIActionHeaderView::HEADER_DARK_GREY; 77 81 } 82 + 78 83 return PHUIActionHeaderView::HEADER_GREY; 84 + } 85 + 86 + public function getProperty($key, $default = null) { 87 + return idx($this->properties, $key, $default); 88 + } 89 + 90 + public function setProperty($key, $value) { 91 + $this->properties[$key] = $value; 92 + return $this; 79 93 } 80 94 81 95
+1 -1
webroot/rsrc/js/application/projects/behavior-reorder-columns.js
··· 37 37 38 38 var parameters = { 39 39 columnPHID: node_data.columnPHID, 40 - sequence: (sequence === null) ? 1 : (parseInt(sequence, 10) + 1) 40 + sequence: (sequence === null) ? 0 : (parseInt(sequence, 10) + 1) 41 41 }; 42 42 43 43 new JX.Workflow(config.reorderURI, parameters)