Differential D19902 Diff 47590 src/applications/tokens/controller/PhabricatorTokenGiveController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/tokens/controller/PhabricatorTokenGiveController.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | if ($current) { | ||||
$is_give = false; | $is_give = false; | ||||
$title = pht('Rescind Token'); | $title = pht('Rescind Token'); | ||||
} else { | } else { | ||||
$is_give = true; | $is_give = true; | ||||
$title = pht('Give Token'); | $title = pht('Give Token'); | ||||
} | } | ||||
$done_uri = $handle->getURI(); | $done_uri = $handle->getURI(); | ||||
if ($request->isDialogFormPost()) { | if ($request->isFormOrHisecPost()) { | ||||
$content_source = PhabricatorContentSource::newFromRequest($request); | $content_source = PhabricatorContentSource::newFromRequest($request); | ||||
$editor = id(new PhabricatorTokenGivenEditor()) | $editor = id(new PhabricatorTokenGivenEditor()) | ||||
->setActor($viewer) | ->setActor($viewer) | ||||
->setRequest($request) | |||||
->setCancelURI($handle->getURI()) | |||||
->setContentSource($content_source); | ->setContentSource($content_source); | ||||
if ($is_give) { | if ($is_give) { | ||||
$token_phid = $request->getStr('tokenPHID'); | $token_phid = $request->getStr('tokenPHID'); | ||||
$editor->addToken($handle->getPHID(), $token_phid); | $editor->addToken($handle->getPHID(), $token_phid); | ||||
} else { | } else { | ||||
$editor->deleteToken($handle->getPHID()); | $editor->deleteToken($handle->getPHID()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |