Skip to content

Commit 2f054ed

Browse files
hach-queepriestley
authored andcommitted
Hide milestone columns when milestone is archived
Summary: Fixes T10310. This replaces the "Hide Column" / "Show Column" option for milestone columns with one that archives/unarchives, and hides milestone columns when the milestone project is archived. Test Plan: - Hid and unhid a normal column (got normal dialogs). - Hid and unhid a milestone column (got "archive project" dialogs, underlying project archived/unarchived, column vanished). Reviewers: hach-que, #blessed_reviewers, chad Reviewed By: #blessed_reviewers, chad Subscribers: jcowgar, Korvin Maniphest Tasks: T10310 Differential Revision: https://secure.phabricator.com/D15231
1 parent a5bbe25 commit 2f054ed

File tree

2 files changed

+72
-29
lines changed

2 files changed

+72
-29
lines changed

src/applications/project/controller/PhabricatorProjectColumnHideController.php

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,42 +52,80 @@ public function handleRequest(AphrontRequest $request) {
5252
->addCancelButton($view_uri, pht('Okay'));
5353
}
5454

55+
$proxy = $column->getProxy();
56+
5557
if ($request->isFormPost()) {
56-
if ($column->isHidden()) {
57-
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
58+
if ($proxy) {
59+
if ($proxy->isArchived()) {
60+
$new_status = PhabricatorProjectStatus::STATUS_ACTIVE;
61+
} else {
62+
$new_status = PhabricatorProjectStatus::STATUS_ARCHIVED;
63+
}
64+
65+
$xactions = array();
66+
67+
$xactions[] = id(new PhabricatorProjectTransaction())
68+
->setTransactionType(PhabricatorProjectTransaction::TYPE_STATUS)
69+
->setNewValue($new_status);
70+
71+
id(new PhabricatorProjectTransactionEditor())
72+
->setActor($viewer)
73+
->setContentSourceFromRequest($request)
74+
->setContinueOnNoEffect(true)
75+
->setContinueOnMissingFields(true)
76+
->applyTransactions($proxy, $xactions);
5877
} else {
59-
$new_status = PhabricatorProjectColumn::STATUS_HIDDEN;
78+
if ($column->isHidden()) {
79+
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
80+
} else {
81+
$new_status = PhabricatorProjectColumn::STATUS_HIDDEN;
82+
}
83+
84+
$type_status = PhabricatorProjectColumnTransaction::TYPE_STATUS;
85+
$xactions = array(
86+
id(new PhabricatorProjectColumnTransaction())
87+
->setTransactionType($type_status)
88+
->setNewValue($new_status),
89+
);
90+
91+
$editor = id(new PhabricatorProjectColumnTransactionEditor())
92+
->setActor($viewer)
93+
->setContinueOnNoEffect(true)
94+
->setContentSourceFromRequest($request)
95+
->applyTransactions($column, $xactions);
6096
}
6197

62-
$type_status = PhabricatorProjectColumnTransaction::TYPE_STATUS;
63-
$xactions = array(
64-
id(new PhabricatorProjectColumnTransaction())
65-
->setTransactionType($type_status)
66-
->setNewValue($new_status),
67-
);
68-
69-
$editor = id(new PhabricatorProjectColumnTransactionEditor())
70-
->setActor($viewer)
71-
->setContinueOnNoEffect(true)
72-
->setContentSourceFromRequest($request)
73-
->applyTransactions($column, $xactions);
74-
7598
return id(new AphrontRedirectResponse())->setURI($view_uri);
7699
}
77100

78-
if ($column->isHidden()) {
79-
$title = pht('Show Column');
80-
} else {
81-
$title = pht('Hide Column');
82-
}
83-
84-
if ($column->isHidden()) {
85-
$body = pht(
86-
'Are you sure you want to show this column?');
101+
if ($proxy) {
102+
if ($column->isHidden()) {
103+
$title = pht('Activate and Show Column');
104+
$body = pht(
105+
'This column is hidden because it represents an archived '.
106+
'subproject. Do you want to activate the subproject so the '.
107+
'column is visible again?');
108+
$button = pht('Activate Subproject');
109+
} else {
110+
$title = pht('Archive and Hide Column');
111+
$body = pht(
112+
'This column is visible because it represents an active '.
113+
'subproject. Do you want to hide the column by archiving the '.
114+
'subproject?');
115+
$button = pht('Archive Subproject');
116+
}
87117
} else {
88-
$body = pht(
89-
'Are you sure you want to hide this column? It will no longer '.
90-
'appear on the workboard.');
118+
if ($column->isHidden()) {
119+
$title = pht('Show Column');
120+
$body = pht('Are you sure you want to show this column?');
121+
$button = pht('Show Column');
122+
} else {
123+
$title = pht('Hide Column');
124+
$body = pht(
125+
'Are you sure you want to hide this column? It will no longer '.
126+
'appear on the workboard.');
127+
$button = pht('Hide Column');
128+
}
91129
}
92130

93131
$dialog = $this->newDialog()
@@ -96,7 +134,7 @@ public function handleRequest(AphrontRequest $request) {
96134
->appendChild($body)
97135
->setDisableWorkflowOnCancel(true)
98136
->addCancelButton($view_uri)
99-
->addSubmitButton($title);
137+
->addSubmitButton($button);
100138

101139
foreach ($request->getPassthroughRequestData() as $key => $value) {
102140
$dialog->addHiddenInput($key, $value);

src/applications/project/storage/PhabricatorProjectColumn.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public function isDefaultColumn() {
8686
}
8787

8888
public function isHidden() {
89+
$proxy = $this->getProxy();
90+
if ($proxy) {
91+
return $proxy->isArchived();
92+
}
93+
8994
return ($this->getStatus() == self::STATUS_HIDDEN);
9095
}
9196

0 commit comments

Comments
 (0)