@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 69 lines 2.0 kB view raw
1<?php 2 3final class PhabricatorBadgesArchiveController 4 extends PhabricatorBadgesController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $request->getViewer(); 8 $id = $request->getURIData('id'); 9 10 $badge = id(new PhabricatorBadgesQuery()) 11 ->setViewer($viewer) 12 ->withIDs(array($id)) 13 ->requireCapabilities( 14 array( 15 PhabricatorPolicyCapability::CAN_VIEW, 16 PhabricatorPolicyCapability::CAN_EDIT, 17 )) 18 ->executeOne(); 19 if (!$badge) { 20 return new Aphront404Response(); 21 } 22 23 $view_uri = $this->getApplicationURI('view/'.$badge->getID().'/'); 24 25 if ($request->isFormPost()) { 26 if ($badge->isArchived()) { 27 $new_status = PhabricatorBadgesBadge::STATUS_ACTIVE; 28 } else { 29 $new_status = PhabricatorBadgesBadge::STATUS_ARCHIVED; 30 } 31 32 $xactions = array(); 33 34 $xactions[] = id(new PhabricatorBadgesTransaction()) 35 ->setTransactionType( 36 PhabricatorBadgesBadgeStatusTransaction::TRANSACTIONTYPE) 37 ->setNewValue($new_status); 38 39 id(new PhabricatorBadgesEditor()) 40 ->setActor($viewer) 41 ->setContentSourceFromRequest($request) 42 ->setContinueOnNoEffect(true) 43 ->setContinueOnMissingFields(true) 44 ->applyTransactions($badge, $xactions); 45 46 return id(new AphrontRedirectResponse())->setURI($view_uri); 47 } 48 49 if ($badge->isArchived()) { 50 $title = pht('Activate Badge'); 51 $body = pht('This badge will be re-commissioned into service.'); 52 $button = pht('Activate Badge'); 53 } else { 54 $title = pht('Archive Badge'); 55 $body = pht( 56 'This dedicated badge, once a distinguish icon of this install, '. 57 'shall be immediately retired from service, but will never far from '. 58 'our hearts. Godspeed.'); 59 $button = pht('Archive Badge'); 60 } 61 62 return $this->newDialog() 63 ->setTitle($title) 64 ->appendChild($body) 65 ->addCancelButton($view_uri) 66 ->addSubmitButton($button); 67 } 68 69}