1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 07:11:04 +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:
epriestley 2017-05-14 13:39:54 -07:00
parent 95925ad58f
commit d2e1dd0ef0

View file

@ -32,7 +32,6 @@ final class PhabricatorApplicationEditController
if ($request->isFormPost()) { if ($request->isFormPost()) {
$xactions = array(); $xactions = array();
$result = array();
$template = $application->getApplicationTransactionTemplate(); $template = $application->getApplicationTransactionTemplate();
foreach ($application->getCapabilities() as $capability) { foreach ($application->getCapabilities() as $capability) {
if (!$application->isCapabilityEditable($capability)) { if (!$application->isCapabilityEditable($capability)) {
@ -47,8 +46,6 @@ final class PhabricatorApplicationEditController
continue; continue;
} }
$result[$capability] = $new;
$xactions[] = id(clone $template) $xactions[] = id(clone $template)
->setTransactionType( ->setTransactionType(
PhabricatorApplicationPolicyChangeTransaction::TRANSACTIONTYPE) PhabricatorApplicationPolicyChangeTransaction::TRANSACTIONTYPE)
@ -58,7 +55,6 @@ final class PhabricatorApplicationEditController
->setNewValue($new); ->setNewValue($new);
} }
if ($result) {
$editor = id(new PhabricatorApplicationEditor()) $editor = id(new PhabricatorApplicationEditor())
->setActor($user) ->setActor($user)
->setContentSourceFromRequest($request) ->setContentSourceFromRequest($request)
@ -73,11 +69,10 @@ final class PhabricatorApplicationEditController
} }
return $this->newDialog() return $this->newDialog()
->setTitle('Validation Failed') ->setTitle(pht('Validation Failed'))
->setValidationException($validation_exception) ->setValidationException($validation_exception)
->addCancelButton($view_uri); ->addCancelButton($view_uri);
} }
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$user, $user,