3 final class PhabricatorBadgesRemoveRecipientsController
4 extends PhabricatorBadgesController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
8 $id = $request->getURIData('id');
10 $badge = id(new PhabricatorBadgesQuery())
13 ->requireCapabilities(
15 PhabricatorPolicyCapability
::CAN_VIEW
,
16 PhabricatorPolicyCapability
::CAN_EDIT
,
20 return new Aphront404Response();
23 $remove_phid = $request->getStr('phid');
24 $view_uri = $this->getApplicationURI('recipients/'.$badge->getID().'/');
26 if ($request->isFormPost()) {
28 $xactions[] = id(new PhabricatorBadgesTransaction())
30 PhabricatorBadgesBadgeRevokeTransaction
::TRANSACTIONTYPE
)
31 ->setNewValue(array($remove_phid));
33 $editor = id(new PhabricatorBadgesEditor())
35 ->setContentSourceFromRequest($request)
36 ->setContinueOnNoEffect(true)
37 ->setContinueOnMissingFields(true)
38 ->applyTransactions($badge, $xactions);
40 return id(new AphrontRedirectResponse())
44 $handle = id(new PhabricatorHandleQuery())
46 ->withPHIDs(array($remove_phid))
49 $dialog = id(new AphrontDialogView())
51 ->setTitle(pht('Really Revoke Badge?'))
54 'Really revoke the badge "%s" from %s?',
55 phutil_tag('strong', array(), $badge->getName()),
56 phutil_tag('strong', array(), $handle->getName())))
57 ->addCancelButton($view_uri)
58 ->addSubmitButton(pht('Revoke Badge'));