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

Create button should be a dropdown with public and private options

Summary: Ref T8026, Create button should be a dropdown with public and private options

Test Plan: Create both a public and private event. Confirm view policies apply correctly.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8026

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

+40 -4
+13 -1
src/applications/calendar/controller/PhabricatorCalendarController.php
··· 5 5 protected function buildApplicationCrumbs() { 6 6 $crumbs = parent::buildApplicationCrumbs(); 7 7 8 + $actions = id(new PhabricatorActionListView()) 9 + ->setUser($this->getViewer()) 10 + ->addAction( 11 + id(new PhabricatorActionView()) 12 + ->setName(pht('Create Private Event')) 13 + ->setHref('/calendar/event/create/?mode=private')) 14 + ->addAction( 15 + id(new PhabricatorActionView()) 16 + ->setName(pht('Create Public Event')) 17 + ->setHref('/calendar/event/create/?mode=public')); 18 + 8 19 $crumbs->addAction( 9 20 id(new PHUIListItemView()) 10 21 ->setName(pht('Create Event')) 11 22 ->setHref($this->getApplicationURI().'event/create/') 12 - ->setIcon('fa-plus-square')); 23 + ->setIcon('fa-plus-square') 24 + ->setDropdownMenu($actions)); 13 25 14 26 return $crumbs; 15 27 }
+4 -1
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 29 29 $uri_query = $request->getStr('query'); 30 30 31 31 if ($this->isCreate()) { 32 - $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($viewer); 32 + $mode = $request->getStr('mode'); 33 + $event = PhabricatorCalendarEvent::initializeNewCalendarEvent( 34 + $viewer, 35 + $mode); 33 36 34 37 $create_start_year = $request->getInt('year'); 35 38 $create_start_month = $request->getInt('month');
+10 -2
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 28 28 private $invitees = self::ATTACHABLE; 29 29 private $appliedViewer; 30 30 31 - public static function initializeNewCalendarEvent(PhabricatorUser $actor) { 31 + public static function initializeNewCalendarEvent( 32 + PhabricatorUser $actor, 33 + $mode) { 32 34 $app = id(new PhabricatorApplicationQuery()) 33 35 ->setViewer($actor) 34 36 ->withClasses(array('PhabricatorCalendarApplication')) 35 37 ->executeOne(); 36 38 39 + if ($mode == 'public') { 40 + $view_policy = PhabricatorPolicies::getMostOpenPolicy(); 41 + } else { 42 + $view_policy = $actor->getPHID(); 43 + } 44 + 37 45 return id(new PhabricatorCalendarEvent()) 38 46 ->setUserPHID($actor->getPHID()) 39 47 ->setIsCancelled(0) 40 48 ->setIsAllDay(0) 41 49 ->setIcon(self::DEFAULT_ICON) 42 - ->setViewPolicy($actor->getPHID()) 50 + ->setViewPolicy($view_policy) 43 51 ->setEditPolicy($actor->getPHID()) 44 52 ->attachInvitees(array()) 45 53 ->applyViewerTimezone($actor);
+1
src/view/phui/PHUICrumbsView.php
··· 84 84 'class' => implode(' ', $action_classes), 85 85 'sigil' => implode(' ', $action_sigils), 86 86 'style' => $action->getStyle(), 87 + 'meta' => $action->getMetadata(), 87 88 ), 88 89 array( 89 90 $icon,
+12
src/view/phui/PHUIListItemView.php
··· 29 29 private $aural; 30 30 private $profileImage; 31 31 32 + public function setDropdownMenu(PhabricatorActionListView $actions) { 33 + Javelin::initBehavior('phui-dropdown-menu'); 34 + 35 + $this->addSigil('phui-dropdown-menu'); 36 + $this->setMetadata( 37 + array( 38 + 'items' => $actions, 39 + )); 40 + 41 + return $this; 42 + } 43 + 32 44 public function setAural($aural) { 33 45 $this->aural = $aural; 34 46 return $this;