mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
In Applications, always redirect back to the detail page after edits
Summary: Ref T12685. When you edit an application's policies but don't make any changes, you currently get stuck on the same page. This isn't how other edit screens work, and I think it's a holdover from eras long ago. Make it consistent with other applications. Also, fix a missing `pht()`. Test Plan: - Edited an application configuation. - Clicked "Save" without making changes. - After patch, was redirected back to detail page like in other applications. Reviewers: chad, amckinley Reviewed By: chad Maniphest Tasks: T12685 Differential Revision: https://secure.phabricator.com/D17877
This commit is contained in:
parent
95925ad58f
commit
d2e1dd0ef0
1 changed files with 15 additions and 20 deletions
|
@ -32,7 +32,6 @@ final class PhabricatorApplicationEditController
|
|||
if ($request->isFormPost()) {
|
||||
$xactions = array();
|
||||
|
||||
$result = array();
|
||||
$template = $application->getApplicationTransactionTemplate();
|
||||
foreach ($application->getCapabilities() as $capability) {
|
||||
if (!$application->isCapabilityEditable($capability)) {
|
||||
|
@ -47,8 +46,6 @@ final class PhabricatorApplicationEditController
|
|||
continue;
|
||||
}
|
||||
|
||||
$result[$capability] = $new;
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType(
|
||||
PhabricatorApplicationPolicyChangeTransaction::TRANSACTIONTYPE)
|
||||
|
@ -58,25 +55,23 @@ final class PhabricatorApplicationEditController
|
|||
->setNewValue($new);
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$editor = id(new PhabricatorApplicationEditor())
|
||||
->setActor($user)
|
||||
->setContentSourceFromRequest($request)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true);
|
||||
$editor = id(new PhabricatorApplicationEditor())
|
||||
->setActor($user)
|
||||
->setContentSourceFromRequest($request)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true);
|
||||
|
||||
try {
|
||||
$editor->applyTransactions($application, $xactions);
|
||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
||||
$validation_exception = $ex;
|
||||
}
|
||||
|
||||
return $this->newDialog()
|
||||
->setTitle('Validation Failed')
|
||||
->setValidationException($validation_exception)
|
||||
->addCancelButton($view_uri);
|
||||
try {
|
||||
$editor->applyTransactions($application, $xactions);
|
||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
||||
$validation_exception = $ex;
|
||||
}
|
||||
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Validation Failed'))
|
||||
->setValidationException($validation_exception)
|
||||
->addCancelButton($view_uri);
|
||||
}
|
||||
|
||||
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
|
||||
|
|
Loading…
Reference in a new issue