@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 recaptime-dev/main 56 lines 1.7 kB view raw
1<?php 2 3final class PhabricatorCalendarEventAvailabilityController 4 extends PhabricatorCalendarController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $this->getViewer(); 8 $id = $request->getURIData('id'); 9 10 $event = id(new PhabricatorCalendarEventQuery()) 11 ->setViewer($viewer) 12 ->withIDs(array($id)) 13 ->executeOne(); 14 if (!$event) { 15 return new Aphront404Response(); 16 } 17 18 $response = $this->newImportedEventResponse($event); 19 if ($response) { 20 return $response; 21 } 22 23 $cancel_uri = $event->getURI(); 24 25 if (!$event->getIsUserAttending($viewer->getPHID())) { 26 return $this->newDialog() 27 ->setTitle(pht('Not Attending Event')) 28 ->appendParagraph( 29 pht( 30 'You can not change your display availability for events you '. 31 'are not attending.')) 32 ->addCancelButton($cancel_uri); 33 } 34 35 // TODO: This endpoint currently only works via AJAX. It would be vaguely 36 // nice to provide a plain HTML version of the workflow where we return 37 // a dialog with a vanilla <select /> in it for cases where all the JS 38 // breaks. 39 $request->validateCSRF(); 40 41 $invitee = $event->getInviteeForPHID($viewer->getPHID()); 42 43 $map = PhabricatorCalendarEventInvitee::getAvailabilityMap(); 44 $new_availability = $request->getURIData('availability'); 45 if (isset($map[$new_availability])) { 46 $invitee 47 ->setAvailability($new_availability) 48 ->save(); 49 50 // Invalidate the availability cache. 51 $viewer->writeAvailabilityCache(array(), null); 52 } 53 54 return id(new AphrontRedirectResponse())->setURI($cancel_uri); 55 } 56}