diff --git a/resources/celerity/map.php b/resources/celerity/map.php index de88cde6f9..42d0f018b8 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -94,7 +94,7 @@ return array( 'rsrc/css/application/ponder/feed.css' => 'e62615b6', 'rsrc/css/application/ponder/post.css' => 'ebab8a70', 'rsrc/css/application/ponder/vote.css' => '8ed6ed8b', - 'rsrc/css/application/profile/profile-view.css' => 'fddedfa1', + 'rsrc/css/application/profile/profile-view.css' => 'b4896815', 'rsrc/css/application/projects/project-icon.css' => 'c2ecb7f1', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', @@ -731,7 +731,7 @@ return array( 'phabricator-object-selector-css' => '029a133d', 'phabricator-phtize' => 'd254d646', 'phabricator-prefab' => '72da38cc', - 'phabricator-profile-css' => 'fddedfa1', + 'phabricator-profile-css' => 'b4896815', 'phabricator-remarkup-css' => '0ee3d256', 'phabricator-search-results-css' => 'f240504c', 'phabricator-shaped-request' => '7cbe244b', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 1b8df8a31a..75df658c80 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -177,7 +177,6 @@ phutil_register_library_map(array( 'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php', 'ArcanistConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistConduitAPIMethod.php', 'ArcanistProjectInfoConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php', - 'AuditActionMenuEventListener' => 'applications/audit/events/AuditActionMenuEventListener.php', 'AuditConduitAPIMethod' => 'applications/audit/conduit/AuditConduitAPIMethod.php', 'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php', 'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php', @@ -222,7 +221,6 @@ phutil_register_library_map(array( 'ConduitQueryConduitAPIMethod' => 'applications/conduit/method/ConduitQueryConduitAPIMethod.php', 'ConduitSSHWorkflow' => 'applications/conduit/ssh/ConduitSSHWorkflow.php', 'ConduitTokenGarbageCollector' => 'applications/conduit/garbagecollector/ConduitTokenGarbageCollector.php', - 'ConpherenceActionMenuEventListener' => 'applications/conpherence/events/ConpherenceActionMenuEventListener.php', 'ConpherenceConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceConduitAPIMethod.php', 'ConpherenceConfigOptions' => 'applications/conpherence/config/ConpherenceConfigOptions.php', 'ConpherenceConstants' => 'applications/conpherence/constants/ConpherenceConstants.php', @@ -990,7 +988,6 @@ phutil_register_library_map(array( 'MacroConduitAPIMethod' => 'applications/macro/conduit/MacroConduitAPIMethod.php', 'MacroCreateMemeConduitAPIMethod' => 'applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php', 'MacroQueryConduitAPIMethod' => 'applications/macro/conduit/MacroQueryConduitAPIMethod.php', - 'ManiphestActionMenuEventListener' => 'applications/maniphest/event/ManiphestActionMenuEventListener.php', 'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php', 'ManiphestBulkEditCapability' => 'applications/maniphest/capability/ManiphestBulkEditCapability.php', 'ManiphestConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestConduitAPIMethod.php', @@ -2124,6 +2121,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleDisableController' => 'applications/people/controller/PhabricatorPeopleDisableController.php', 'PhabricatorPeopleEmpowerController' => 'applications/people/controller/PhabricatorPeopleEmpowerController.php', 'PhabricatorPeopleExternalPHIDType' => 'applications/people/phid/PhabricatorPeopleExternalPHIDType.php', + 'PhabricatorPeopleFeedController' => 'applications/people/controller/PhabricatorPeopleFeedController.php', 'PhabricatorPeopleHovercardEventListener' => 'applications/people/event/PhabricatorPeopleHovercardEventListener.php', 'PhabricatorPeopleLdapController' => 'applications/people/controller/PhabricatorPeopleLdapController.php', 'PhabricatorPeopleListController' => 'applications/people/controller/PhabricatorPeopleListController.php', @@ -3299,7 +3297,6 @@ phutil_register_library_map(array( 'AphrontWebpageResponse' => 'AphrontHTMLResponse', 'ArcanistConduitAPIMethod' => 'ConduitAPIMethod', 'ArcanistProjectInfoConduitAPIMethod' => 'ArcanistConduitAPIMethod', - 'AuditActionMenuEventListener' => 'PhabricatorEventListener', 'AuditConduitAPIMethod' => 'ConduitAPIMethod', 'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod', 'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability', @@ -3335,7 +3332,6 @@ phutil_register_library_map(array( 'ConduitQueryConduitAPIMethod' => 'ConduitAPIMethod', 'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow', 'ConduitTokenGarbageCollector' => 'PhabricatorGarbageCollector', - 'ConpherenceActionMenuEventListener' => 'PhabricatorEventListener', 'ConpherenceConduitAPIMethod' => 'ConduitAPIMethod', 'ConpherenceConfigOptions' => 'PhabricatorApplicationConfigOptions', 'ConpherenceController' => 'PhabricatorController', @@ -4165,7 +4161,6 @@ phutil_register_library_map(array( 'MacroConduitAPIMethod' => 'ConduitAPIMethod', 'MacroCreateMemeConduitAPIMethod' => 'MacroConduitAPIMethod', 'MacroQueryConduitAPIMethod' => 'MacroConduitAPIMethod', - 'ManiphestActionMenuEventListener' => 'PhabricatorEventListener', 'ManiphestBatchEditController' => 'ManiphestController', 'ManiphestBulkEditCapability' => 'PhabricatorPolicyCapability', 'ManiphestConduitAPIMethod' => 'ConduitAPIMethod', @@ -4362,7 +4357,7 @@ phutil_register_library_map(array( 'PHUIObjectItemListExample' => 'PhabricatorUIExample', 'PHUIObjectItemListView' => 'AphrontTagView', 'PHUIObjectItemView' => 'AphrontTagView', - 'PHUIPagedFormView' => 'AphrontTagView', + 'PHUIPagedFormView' => 'AphrontView', 'PHUIPinboardItemView' => 'AphrontView', 'PHUIPinboardView' => 'AphrontView', 'PHUIPropertyGroupView' => 'AphrontTagView', @@ -5375,6 +5370,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleDisableController' => 'PhabricatorPeopleController', 'PhabricatorPeopleEmpowerController' => 'PhabricatorPeopleController', 'PhabricatorPeopleExternalPHIDType' => 'PhabricatorPHIDType', + 'PhabricatorPeopleFeedController' => 'PhabricatorPeopleController', 'PhabricatorPeopleHovercardEventListener' => 'PhabricatorEventListener', 'PhabricatorPeopleLdapController' => 'PhabricatorPeopleController', 'PhabricatorPeopleListController' => 'PhabricatorPeopleController', diff --git a/src/applications/audit/application/PhabricatorAuditApplication.php b/src/applications/audit/application/PhabricatorAuditApplication.php index 7b611d0969..a3b3448fdb 100644 --- a/src/applications/audit/application/PhabricatorAuditApplication.php +++ b/src/applications/audit/application/PhabricatorAuditApplication.php @@ -26,12 +26,6 @@ final class PhabricatorAuditApplication extends PhabricatorApplication { return PhabricatorEnv::getDoclink('Audit User Guide'); } - public function getEventListeners() { - return array( - new AuditActionMenuEventListener(), - ); - } - public function getRoutes() { return array( '/audit/' => array( diff --git a/src/applications/audit/events/AuditActionMenuEventListener.php b/src/applications/audit/events/AuditActionMenuEventListener.php deleted file mode 100644 index 82cfb0a85c..0000000000 --- a/src/applications/audit/events/AuditActionMenuEventListener.php +++ /dev/null @@ -1,44 +0,0 @@ -listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); - } - - public function handleEvent(PhutilEvent $event) { - switch ($event->getType()) { - case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS: - $this->handleActionsEvent($event); - break; - } - } - - private function handleActionsEvent(PhutilEvent $event) { - $object = $event->getValue('object'); - - $actions = null; - if ($object instanceof PhabricatorUser) { - $actions = $this->renderUserItems($event); - } - - $this->addActionMenuItems($event, $actions); - } - - private function renderUserItems(PhutilEvent $event) { - if (!$this->canUseApplication($event->getUser())) { - return null; - } - - $user = $event->getValue('object'); - - $username = phutil_escape_uri($user->getUsername()); - $view_uri = '/audit/?authors='.$username; - - return id(new PhabricatorActionView()) - ->setIcon('fa-check-circle-o') - ->setName(pht('View Commits')) - ->setHref($view_uri); - } - -} diff --git a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php index 6220d169dc..210291f8e5 100644 --- a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php +++ b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php @@ -24,7 +24,6 @@ final class PhabricatorConpherenceApplication extends PhabricatorApplication { public function getEventListeners() { return array( - new ConpherenceActionMenuEventListener(), new ConpherenceHovercardEventListener(), ); } diff --git a/src/applications/conpherence/events/ConpherenceActionMenuEventListener.php b/src/applications/conpherence/events/ConpherenceActionMenuEventListener.php deleted file mode 100644 index 416fd291af..0000000000 --- a/src/applications/conpherence/events/ConpherenceActionMenuEventListener.php +++ /dev/null @@ -1,44 +0,0 @@ -listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); - } - - public function handleEvent(PhutilEvent $event) { - switch ($event->getType()) { - case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS: - $this->handleActionsEvent($event); - break; - } - } - - private function handleActionsEvent(PhutilEvent $event) { - $object = $event->getValue('object'); - - $actions = null; - if ($object instanceof PhabricatorUser) { - $actions = $this->renderUserItems($event); - } - - $this->addActionMenuItems($event, $actions); - } - - private function renderUserItems(PhutilEvent $event) { - if (!$this->canUseApplication($event->getUser())) { - return null; - } - - $user = $event->getValue('object'); - $href = '/conpherence/new/?participant='.$user->getPHID(); - - return id(new PhabricatorActionView()) - ->setIcon('fa-envelope') - ->setName(pht('Send Message')) - ->setWorkflow(true) - ->setHref($href); - } - -} diff --git a/src/applications/differential/event/DifferentialActionMenuEventListener.php b/src/applications/differential/event/DifferentialActionMenuEventListener.php index 99680b1915..a35f834136 100644 --- a/src/applications/differential/event/DifferentialActionMenuEventListener.php +++ b/src/applications/differential/event/DifferentialActionMenuEventListener.php @@ -19,27 +19,11 @@ final class DifferentialActionMenuEventListener $object = $event->getValue('object'); $actions = null; - if ($object instanceof PhabricatorUser) { - $actions = $this->renderUserItems($event); - } else if ($object instanceof ManiphestTask) { + if ($object instanceof ManiphestTask) { $actions = $this->renderTaskItems($event); + $this->addActionMenuItems($event, $actions); } - $this->addActionMenuItems($event, $actions); - } - - private function renderUserItems(PhutilEvent $event) { - if (!$this->canUseApplication($event->getUser())) { - return null; - } - - $person = $event->getValue('object'); - $href = '/differential/?authors='.$person->getUsername(); - - return id(new PhabricatorActionView()) - ->setIcon('fa-cog') - ->setName(pht('View Revisions')) - ->setHref($href); } private function renderTaskItems(PhutilEvent $event) { diff --git a/src/applications/maniphest/application/PhabricatorManiphestApplication.php b/src/applications/maniphest/application/PhabricatorManiphestApplication.php index fa2e2c0c90..3f0ebb7674 100644 --- a/src/applications/maniphest/application/PhabricatorManiphestApplication.php +++ b/src/applications/maniphest/application/PhabricatorManiphestApplication.php @@ -39,7 +39,6 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication { public function getEventListeners() { return array( new ManiphestNameIndexEventListener(), - new ManiphestActionMenuEventListener(), new ManiphestHovercardEventListener(), ); } diff --git a/src/applications/maniphest/event/ManiphestActionMenuEventListener.php b/src/applications/maniphest/event/ManiphestActionMenuEventListener.php deleted file mode 100644 index 867d42eb24..0000000000 --- a/src/applications/maniphest/event/ManiphestActionMenuEventListener.php +++ /dev/null @@ -1,46 +0,0 @@ -listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); - } - - public function handleEvent(PhutilEvent $event) { - switch ($event->getType()) { - case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS: - $this->handleActionsEvent($event); - break; - } - } - - private function handleActionsEvent(PhutilEvent $event) { - $object = $event->getValue('object'); - - $actions = null; - if ($object instanceof PhabricatorUser) { - $actions = $this->renderUserItems($event); - } - - $this->addActionMenuItems($event, $actions); - } - - private function renderUserItems(PhutilEvent $event) { - if (!$this->canUseApplication($event->getUser())) { - return null; - } - - $user = $event->getValue('object'); - $phid = $user->getPHID(); - $view_uri = sprintf( - '/maniphest/?statuses=%s&assigned=%s#R', - implode(',', ManiphestTaskStatus::getOpenStatusConstants()), - $phid); - - return id(new PhabricatorActionView()) - ->setIcon('fa-anchor') - ->setName(pht('View Tasks')) - ->setHref($view_uri); - } - -} diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php index d46a2c4f6d..4b092483d6 100644 --- a/src/applications/people/application/PhabricatorPeopleApplication.php +++ b/src/applications/people/application/PhabricatorPeopleApplication.php @@ -62,11 +62,13 @@ final class PhabricatorPeopleApplication extends PhabricatorApplication { 'PhabricatorPeopleProfileEditController', 'picture/(?P[1-9]\d*)/' => 'PhabricatorPeopleProfilePictureController', - ), + ), '/p/(?P[\w._-]+)/' => 'PhabricatorPeopleProfileController', '/p/(?P[\w._-]+)/calendar/' => 'PhabricatorPeopleCalendarController', + '/p/(?P[\w._-]+)/feed/' + => 'PhabricatorPeopleFeedController', ); } diff --git a/src/applications/people/controller/PhabricatorPeopleCalendarController.php b/src/applications/people/controller/PhabricatorPeopleCalendarController.php index 8f49408bad..ba6740f8f7 100644 --- a/src/applications/people/controller/PhabricatorPeopleCalendarController.php +++ b/src/applications/people/controller/PhabricatorPeopleCalendarController.php @@ -73,17 +73,15 @@ final class PhabricatorPeopleCalendarController $month_view->addEvent($event); } - $date = new DateTime("{$year}-{$month}-01"); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb( - $user->getUsername(), - '/p/'.$user->getUsername().'/'); - $crumbs->addTextCrumb($date->format('F Y')); + $name = $user->getUsername(); + + $nav = $this->buildIconNavView($user); + $nav->selectFilter("{$name}/calendar/"); + $nav->appendChild($month_view); return $this->buildApplicationPage( array( - $crumbs, - $month_view, + $nav, ), array( 'title' => pht('Calendar'), diff --git a/src/applications/people/controller/PhabricatorPeopleController.php b/src/applications/people/controller/PhabricatorPeopleController.php index 32e2fcd713..c350caba8d 100644 --- a/src/applications/people/controller/PhabricatorPeopleController.php +++ b/src/applications/people/controller/PhabricatorPeopleController.php @@ -6,47 +6,93 @@ abstract class PhabricatorPeopleController extends PhabricatorController { return true; } - public function buildSideNavView() { + public function buildSideNavView($for_app = false) { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); - $viewer = $this->getRequest()->getUser(); - - id(new PhabricatorPeopleSearchEngine()) - ->setViewer($viewer) - ->addNavigationItems($nav->getMenu()); - - if ($viewer->getIsAdmin()) { - $nav->addLabel(pht('User Administration')); - if (PhabricatorLDAPAuthProvider::getLDAPProvider()) { - $nav->addFilter('ldap', pht('Import from LDAP')); + $name = null; + if ($for_app) { + $name = $this->getRequest()->getURIData('username'); + if ($name) { + $nav->setBaseURI(new PhutilURI('/p/')); + $nav->addFilter("{$name}/", $name); + $nav->addFilter("feed/{$name}/", pht('Feed')); + $nav->addFilter("calendar/{$name}/", pht('Calendar')); } + } - $nav->addFilter('logs', pht('Activity Logs')); + if (!$name) { + $viewer = $this->getRequest()->getUser(); + id(new PhabricatorPeopleSearchEngine()) + ->setViewer($viewer) + ->addNavigationItems($nav->getMenu()); + + if ($viewer->getIsAdmin()) { + $nav->addLabel(pht('User Administration')); + if (PhabricatorLDAPAuthProvider::getLDAPProvider()) { + $nav->addFilter('ldap', pht('Import from LDAP')); + } + + $nav->addFilter('logs', pht('Activity Logs')); + } } return $nav; } public function buildApplicationMenu() { - return $this->buildSideNavView()->getMenu(); + return $this->buildSideNavView(true)->getMenu(); } protected function buildApplicationCrumbs() { - $crumbs = parent::buildApplicationCrumbs(); + return parent::buildApplicationCrumbs(); + } - $viewer = $this->getRequest()->getUser(); + public function buildIconNavView(PhabricatorUser $user) { + $viewer = $this->getViewer(); + $picture = $user->getProfileImageURI(); + $name = $user->getUsername(); - $can_create = $this->hasApplicationCapability( - PeopleCreateUsersCapability::CAPABILITY); - $crumbs->addAction( - id(new PHUIListItemView()) - ->setName(pht('Create New User')) - ->setHref($this->getApplicationURI('create/')) - ->setDisabled(!$can_create) - ->setIcon('fa-plus-square')); + $nav = new AphrontSideNavFilterView(); + $nav->setIconNav(true); + $nav->setBaseURI(new PhutilURI('/p/')); + $nav->addIcon("{$name}/", $name, null, $picture); + $nav->addIcon("{$name}/feed/", pht('Feed'), 'fa-newspaper-o'); - return $crumbs; + $class = 'PhabricatorCalendarApplication'; + if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + $nav->addIcon( + "{$name}/calendar/", pht('Calendar'), 'fa-calendar'); + } + + $class = 'PhabricatorManiphestApplication'; + if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + $phid = $user->getPHID(); + $view_uri = sprintf( + '/maniphest/?statuses=%s&assigned=%s#R', + implode(',', ManiphestTaskStatus::getOpenStatusConstants()), + $phid); + $nav->addIcon( + 'maniphest', pht('Open Tasks'), 'fa-anchor', null, $view_uri); + } + + $class = 'PhabricatorDifferentialApplication'; + if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + $username = phutil_escape_uri($name); + $view_uri = '/differential/?authors='.$username; + $nav->addIcon( + 'differential', pht('Revisions'), 'fa-cog', null, $view_uri); + } + + $class = 'PhabricatorAuditApplication'; + if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + $username = phutil_escape_uri($name); + $view_uri = '/audit/?authors='.$username; + $nav->addIcon( + 'audit', pht('Commits'), 'fa-code', null, $view_uri); + } + + return $nav; } } diff --git a/src/applications/people/controller/PhabricatorPeopleFeedController.php b/src/applications/people/controller/PhabricatorPeopleFeedController.php new file mode 100644 index 0000000000..e4d2fb6af2 --- /dev/null +++ b/src/applications/people/controller/PhabricatorPeopleFeedController.php @@ -0,0 +1,60 @@ +username = idx($data, 'username'); + } + + public function processRequest() { + require_celerity_resource('phabricator-profile-css'); + $viewer = $this->getRequest()->getUser(); + $user = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withUsernames(array($this->username)) + ->needProfileImage(true) + ->executeOne(); + + if (!$user) { + return new Aphront404Response(); + } + + $query = new PhabricatorFeedQuery(); + $query->setFilterPHIDs( + array( + $user->getPHID(), + )); + $query->setLimit(100); + $query->setViewer($viewer); + $stories = $query->execute(); + + $builder = new PhabricatorFeedBuilder($stories); + $builder->setUser($viewer); + $builder->setShowHovercards(true); + $view = $builder->buildView(); + + $feed = phutil_tag_div( + 'phabricator-project-feed', + $view->render()); + $name = $user->getUsername(); + + $nav = $this->buildIconNavView($user); + $nav->selectFilter("{$name}/feed/"); + $nav->appendChild($feed); + + return $this->buildApplicationPage( + array( + $nav, + ), + array( + 'title' => pht('Feed'), + )); + } +} diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index ac1a2c6c54..470500aa94 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -128,40 +128,37 @@ final class PhabricatorPeopleProfileController } $properties = $this->buildPropertyView($user, $actions); + $name = $user->getUsername(); $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb($user->getUsername()); + $crumbs->addTextCrumb($name); - $feed = $this->renderUserFeed($user); - $cal_class = 'PhabricatorCalendarApplication'; - $classes = array(); - $classes[] = 'profile-activity-view'; - if (PhabricatorApplication::isClassInstalledForViewer($cal_class, $user)) { - $calendar = $this->renderUserCalendar($user); - $classes[] = 'profile-has-calendar'; - $classes[] = 'grouped'; - } else { - $calendar = null; + $class = 'PhabricatorManiphestApplication'; + if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + $href = '/conpherence/new/?participant='.$user->getPHID(); + $image = id(new PHUIIconView()) + ->setIconFont('fa-comments'); + $button = id(new PHUIButtonView()) + ->setTag('a') + ->setColor(PHUIButtonView::SIMPLE) + ->setIcon($image) + ->setHref($href) + ->setText(pht('Send Message')) + ->setWorkflow(true); + $header->addActionLink($button); } - $activity = phutil_tag( - 'div', - array( - 'class' => implode($classes, ' '), - ), - array( - $calendar, - $feed, - )); $object_box = id(new PHUIObjectBoxView()) ->setHeader($header) ->addPropertyList($properties); + $nav = $this->buildIconNavView($user); + $nav->selectFilter("{$name}/"); + $nav->appendChild($object_box); + return $this->buildApplicationPage( array( - $crumbs, - $object_box, - $activity, + $nav, ), array( 'title' => $user->getUsername(), @@ -186,103 +183,4 @@ final class PhabricatorPeopleProfileController return $view; } - private function renderUserFeed(PhabricatorUser $user) { - $viewer = $this->getRequest()->getUser(); - - $query = new PhabricatorFeedQuery(); - $query->setFilterPHIDs( - array( - $user->getPHID(), - )); - $query->setLimit(100); - $query->setViewer($viewer); - $stories = $query->execute(); - - $builder = new PhabricatorFeedBuilder($stories); - $builder->setUser($viewer); - $builder->setShowHovercards(true); - $view = $builder->buildView(); - - return phutil_tag_div( - 'profile-feed', - $view->render()); - } - - private function renderUserCalendar(PhabricatorUser $user) { - $viewer = $this->getRequest()->getUser(); - $epochs = CalendarTimeUtil::getCalendarEventEpochs( - $viewer, - 'today', - 7); - $start_epoch = $epochs['start_epoch']; - $end_epoch = $epochs['end_epoch']; - $statuses = id(new PhabricatorCalendarEventQuery()) - ->setViewer($viewer) - ->withInvitedPHIDs(array($user->getPHID())) - ->withDateRange($start_epoch, $end_epoch) - ->execute(); - - $timestamps = CalendarTimeUtil::getCalendarWeekTimestamps( - $viewer); - $today = $timestamps['today']; - $epoch_stamps = $timestamps['epoch_stamps']; - $events = array(); - - foreach ($epoch_stamps as $day) { - $epoch_start = $day->format('U'); - $next_day = clone $day; - $next_day->modify('+1 day'); - $epoch_end = $next_day->format('U'); - - foreach ($statuses as $status) { - if ($status->getDateTo() < $epoch_start) { - continue; - } - if ($status->getDateFrom() >= $epoch_end) { - continue; - } - - $event = new AphrontCalendarEventView(); - $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); - - $status_text = $status->getHumanStatus(); - $event->setUserPHID($status->getUserPHID()); - $event->setName($status_text); - $event->setDescription($status->getDescription()); - $event->setEventID($status->getID()); - $events[$epoch_start][] = $event; - } - } - - $week = array(); - foreach ($epoch_stamps as $day) { - $epoch = $day->format('U'); - $headertext = phabricator_format_local_time($epoch, $user, 'l, M d'); - - $list = new PHUICalendarListView(); - $list->setUser($viewer); - $list->showBlankState(true); - if (isset($events[$epoch])) { - foreach ($events[$epoch] as $event) { - $list->addEvent($event); - } - } - - $header = phutil_tag( - 'a', - array( - 'href' => $this->getRequest()->getRequestURI().'calendar/', - ), - $headertext); - - $calendar = new PHUICalendarWidgetView(); - $calendar->setHeader($header); - $calendar->setCalendarList($list); - $week[] = $calendar; - } - - return phutil_tag_div( - 'profile-calendar', - $week); - } } diff --git a/src/applications/people/controller/PhabricatorPeopleProfileEditController.php b/src/applications/people/controller/PhabricatorPeopleProfileEditController.php index c28c4fc3d9..9f450f4808 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileEditController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileEditController.php @@ -20,6 +20,7 @@ final class PhabricatorPeopleProfileEditController $user = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withIDs(array($this->id)) + ->needProfileImage(true) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -60,9 +61,6 @@ final class PhabricatorPeopleProfileEditController } $title = pht('Edit Profile'); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb($user->getUsername(), $profile_uri); - $crumbs->addTextCrumb($title); $form = id(new AphrontFormView()) ->setUser($viewer); @@ -80,10 +78,13 @@ final class PhabricatorPeopleProfileEditController ->setValidationException($validation_exception) ->setForm($form); + $nav = $this->buildIconNavView($user); + $nav->selectFilter('/'); + $nav->appendChild($form_box); + return $this->buildApplicationPage( array( - $crumbs, - $form_box, + $nav, ), array( 'title' => $title, diff --git a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php index 3dab246787..fd8f005e88 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php @@ -20,6 +20,7 @@ final class PhabricatorPeopleProfilePictureController $user = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withIDs(array($this->id)) + ->needProfileImage(true) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -91,9 +92,6 @@ final class PhabricatorPeopleProfilePictureController } $title = pht('Edit Profile Picture'); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb($user->getUsername(), $profile_uri); - $crumbs->addTextCrumb($title); $form = id(new PHUIFormLayoutView()) ->setUser($viewer); @@ -242,11 +240,14 @@ final class PhabricatorPeopleProfilePictureController ->setHeaderText(pht('Upload New Picture')) ->setForm($upload_form); + $nav = $this->buildIconNavView($user); + $nav->selectFilter('/'); + $nav->appendChild($form_box); + $nav->appendChild($upload_box); + return $this->buildApplicationPage( array( - $crumbs, - $form_box, - $upload_box, + $nav, ), array( 'title' => $title, diff --git a/webroot/rsrc/css/application/profile/profile-view.css b/webroot/rsrc/css/application/profile/profile-view.css index 97020aaf37..ce255b5168 100644 --- a/webroot/rsrc/css/application/profile/profile-view.css +++ b/webroot/rsrc/css/application/profile/profile-view.css @@ -33,15 +33,6 @@ margin-left: 16px; } -.profile-activity-view.profile-has-calendar .profile-feed { - margin-left: 332px; -} - -.device-phone .profile-activity-view .profile-calendar { - float: none; - margin: 0 8px; -} - .device-phone .profile-activity-view .profile-feed { float: none; margin: 0 8px;