@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.

Calendar events should support comments

Summary: Closes T7956, Calendar events should support comments.

Test Plan: Open event, add comment, save, comment should appear in timeline.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7956

Differential Revision: https://secure.phabricator.com/D12640

+91
+2
src/__phutil_library_map__.php
··· 1483 1483 'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php', 1484 1484 'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php', 1485 1485 'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php', 1486 + 'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php', 1486 1487 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', 1487 1488 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 1488 1489 'PhabricatorCalendarEventInvalidEpochException' => 'applications/calendar/exception/PhabricatorCalendarEventInvalidEpochException.php', ··· 4818 4819 'PhabricatorFlaggableInterface', 4819 4820 ), 4820 4821 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 4822 + 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', 4821 4823 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 4822 4824 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 4823 4825 'PhabricatorCalendarEventInvalidEpochException' => 'Exception',
+2
src/applications/calendar/application/PhabricatorCalendarApplication.php
··· 55 55 => 'PhabricatorCalendarEventCancelController', 56 56 '(?P<action>join|decline|accept)/(?P<id>[1-9]\d*)/' 57 57 => 'PhabricatorCalendarEventJoinController', 58 + 'comment/(?P<id>[1-9]\d*)/' 59 + => 'PhabricatorCalendarEventCommentController', 58 60 ), 59 61 ), 60 62 );
+69
src/applications/calendar/controller/PhabricatorCalendarEventCommentController.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventCommentController 4 + extends PhabricatorCalendarController { 5 + 6 + private $id; 7 + 8 + 9 + public function willProcessRequest(array $data) { 10 + $this->id = idx($data, 'id'); 11 + } 12 + 13 + public function handleRequest(AphrontRequest $request) { 14 + $user = $request->getUser(); 15 + 16 + if (!$request->isFormPost()) { 17 + return new Aphront400Response(); 18 + } 19 + 20 + $event = id(new PhabricatorCalendarEventQuery()) 21 + ->setViewer($user) 22 + ->withIDs(array($this->id)) 23 + ->executeOne(); 24 + if (!$event) { 25 + return new Aphront404Response(); 26 + } 27 + 28 + $is_preview = $request->isPreviewRequest(); 29 + $draft = PhabricatorDraft::buildFromRequest($request); 30 + 31 + $view_uri = '/'.$event->getMonogram(); 32 + 33 + $xactions = array(); 34 + $xactions[] = id(new PhabricatorCalendarEventTransaction()) 35 + ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) 36 + ->attachComment( 37 + id(new PhabricatorCalendarEventTransactionComment()) 38 + ->setContent($request->getStr('comment'))); 39 + 40 + $editor = id(new PhabricatorCalendarEventEditor()) 41 + ->setActor($user) 42 + ->setContinueOnNoEffect($request->isContinueRequest()) 43 + ->setContentSourceFromRequest($request) 44 + ->setIsPreview($is_preview); 45 + 46 + try { 47 + $xactions = $editor->applyTransactions($event, $xactions); 48 + } catch (PhabricatorApplicationTransactionNoEffectException $ex) { 49 + return id(new PhabricatorApplicationTransactionNoEffectResponse()) 50 + ->setCancelURI($view_uri) 51 + ->setException($ex); 52 + } 53 + 54 + if ($draft) { 55 + $draft->replaceOrDelete(); 56 + } 57 + 58 + if ($request->isAjax() && $is_preview) { 59 + return id(new PhabricatorApplicationTransactionResponse()) 60 + ->setViewer($user) 61 + ->setTransactions($xactions) 62 + ->setIsPreview($is_preview); 63 + } else { 64 + return id(new AphrontRedirectResponse()) 65 + ->setURI($view_uri); 66 + } 67 + } 68 + 69 + }
+15
src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
··· 43 43 ->setHeader($header) 44 44 ->addPropertyList($properties); 45 45 46 + $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); 47 + $add_comment_header = $is_serious 48 + ? pht('Add Comment') 49 + : pht('Add To Plate'); 50 + $draft = PhabricatorDraft::newFromUserAndKey($viewer, $event->getPHID()); 51 + $add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) 52 + ->setUser($viewer) 53 + ->setObjectPHID($event->getPHID()) 54 + ->setDraft($draft) 55 + ->setHeaderText($add_comment_header) 56 + ->setAction( 57 + $this->getApplicationURI('/event/comment/'.$event->getID().'/')) 58 + ->setSubmitButtonName(pht('Add Comment')); 59 + 46 60 return $this->buildApplicationPage( 47 61 array( 48 62 $crumbs, 49 63 $box, 50 64 $timeline, 65 + $add_comment_form, 51 66 ), 52 67 array( 53 68 'title' => $page_title,
+3
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 22 22 $types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL; 23 23 $types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE; 24 24 25 + $types[] = PhabricatorTransactions::TYPE_COMMENT; 25 26 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 26 27 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; 27 28 ··· 119 120 $object->setIsCancelled((int)$xaction->getNewValue()); 120 121 return; 121 122 case PhabricatorCalendarEventTransaction::TYPE_INVITE: 123 + case PhabricatorTransactions::TYPE_COMMENT: 122 124 case PhabricatorTransactions::TYPE_VIEW_POLICY: 123 125 case PhabricatorTransactions::TYPE_EDIT_POLICY: 124 126 case PhabricatorTransactions::TYPE_EDGE: ··· 167 169 ->save(); 168 170 } 169 171 return; 172 + case PhabricatorTransactions::TYPE_COMMENT: 170 173 case PhabricatorTransactions::TYPE_VIEW_POLICY: 171 174 case PhabricatorTransactions::TYPE_EDIT_POLICY: 172 175 case PhabricatorTransactions::TYPE_EDGE: