1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

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
This commit is contained in:
June Rhodes 2016-02-12 05:03:43 -08:00 committed by epriestley
parent a5bbe256c8
commit 2f054edfa2
2 changed files with 72 additions and 29 deletions

View file

@ -52,7 +52,29 @@ final class PhabricatorProjectColumnHideController
->addCancelButton($view_uri, pht('Okay')); ->addCancelButton($view_uri, pht('Okay'));
} }
$proxy = $column->getProxy();
if ($request->isFormPost()) { if ($request->isFormPost()) {
if ($proxy) {
if ($proxy->isArchived()) {
$new_status = PhabricatorProjectStatus::STATUS_ACTIVE;
} else {
$new_status = PhabricatorProjectStatus::STATUS_ARCHIVED;
}
$xactions = array();
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType(PhabricatorProjectTransaction::TYPE_STATUS)
->setNewValue($new_status);
id(new PhabricatorProjectTransactionEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->applyTransactions($proxy, $xactions);
} else {
if ($column->isHidden()) { if ($column->isHidden()) {
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE; $new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
} else { } else {
@ -71,23 +93,39 @@ final class PhabricatorProjectColumnHideController
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request) ->setContentSourceFromRequest($request)
->applyTransactions($column, $xactions); ->applyTransactions($column, $xactions);
}
return id(new AphrontRedirectResponse())->setURI($view_uri); return id(new AphrontRedirectResponse())->setURI($view_uri);
} }
if ($proxy) {
if ($column->isHidden()) {
$title = pht('Activate and Show Column');
$body = pht(
'This column is hidden because it represents an archived '.
'subproject. Do you want to activate the subproject so the '.
'column is visible again?');
$button = pht('Activate Subproject');
} else {
$title = pht('Archive and Hide Column');
$body = pht(
'This column is visible because it represents an active '.
'subproject. Do you want to hide the column by archiving the '.
'subproject?');
$button = pht('Archive Subproject');
}
} else {
if ($column->isHidden()) { if ($column->isHidden()) {
$title = pht('Show Column'); $title = pht('Show Column');
$body = pht('Are you sure you want to show this column?');
$button = pht('Show Column');
} else { } else {
$title = pht('Hide Column'); $title = pht('Hide Column');
}
if ($column->isHidden()) {
$body = pht(
'Are you sure you want to show this column?');
} else {
$body = pht( $body = pht(
'Are you sure you want to hide this column? It will no longer '. 'Are you sure you want to hide this column? It will no longer '.
'appear on the workboard.'); 'appear on the workboard.');
$button = pht('Hide Column');
}
} }
$dialog = $this->newDialog() $dialog = $this->newDialog()
@ -96,7 +134,7 @@ final class PhabricatorProjectColumnHideController
->appendChild($body) ->appendChild($body)
->setDisableWorkflowOnCancel(true) ->setDisableWorkflowOnCancel(true)
->addCancelButton($view_uri) ->addCancelButton($view_uri)
->addSubmitButton($title); ->addSubmitButton($button);
foreach ($request->getPassthroughRequestData() as $key => $value) { foreach ($request->getPassthroughRequestData() as $key => $value) {
$dialog->addHiddenInput($key, $value); $dialog->addHiddenInput($key, $value);

View file

@ -86,6 +86,11 @@ final class PhabricatorProjectColumn
} }
public function isHidden() { public function isHidden() {
$proxy = $this->getProxy();
if ($proxy) {
return $proxy->isArchived();
}
return ($this->getStatus() == self::STATUS_HIDDEN); return ($this->getStatus() == self::STATUS_HIDDEN);
} }