From 627b95bf78d31f90ea3c8ad92894554e6ca14d57 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 23 May 2016 11:17:27 -0700 Subject: [PATCH] Remove calendar panel in profile and make calendar box header a link to user's calendar Summary: Ref T9606, Clicking on the calendar preview header in user's profile page should link to user's full month calendar Test Plan: Open user profile, scroll to calendar preview, click on Calendar box header. This should open the month calendar for the user (not viewer) Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Maniphest Tasks: T9606 Differential Revision: https://secure.phabricator.com/D15967 --- ...PhabricatorPeopleProfileViewController.php | 29 ++++++++++--------- .../PhabricatorPeopleProfilePanelEngine.php | 17 ----------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 323d5f66af..e5073eff94 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -192,7 +192,7 @@ final class PhabricatorPeopleProfileViewController $query = id(new PhabricatorCalendarEventQuery()) ->setViewer($viewer) ->withDateRange($range_start, $range_end) - ->withInvitedPHIDs(array($viewer->getPHID())) + ->withInvitedPHIDs(array($user->getPHID())) ->withIsCancelled(false); $statuses = $query->execute(); @@ -200,23 +200,22 @@ final class PhabricatorPeopleProfileViewController $events = array(); foreach ($statuses as $status) { - $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); + $viewer_is_invited = $status->getIsUserInvited($user->getPHID()); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, $status, PhabricatorPolicyCapability::CAN_EDIT); - $event = new AphrontCalendarEventView(); - $event->setCanEdit($can_edit); - $event->setEventID($status->getID()); - $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); - $event->setIsAllDay($status->getIsAllDay()); - $event->setIcon($status->getIcon()); - $event->setViewerIsInvited($viewer_is_invited); - - $event->setName($status->getName()); - $event->setURI($status->getURI()); + $event = id(new AphrontCalendarEventView()) + ->setCanEdit($can_edit) + ->setEventID($status->getID()) + ->setEpochRange($status->getDateFrom(), $status->getDateTo()) + ->setIsAllDay($status->getIsAllDay()) + ->setIcon($status->getIcon()) + ->setViewerIsInvited($viewer_is_invited) + ->setName($status->getName()) + ->setURI($status->getURI()); $events[] = $event; } @@ -229,7 +228,11 @@ final class PhabricatorPeopleProfileViewController ->render(); $header = id(new PHUIHeaderView()) - ->setHeader(pht('Calendar')); + ->setHeader(pht('Calendar')) + ->setHref( + urisprintf( + '/calendar/?invitedPHIDs=%s#R', + $user->getPHID())); $box = id(new PHUIObjectBoxView()) ->setHeader($header) ->appendChild($day_view) diff --git a/src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php b/src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php index af8608900d..db362d2049 100644 --- a/src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php +++ b/src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php @@ -26,23 +26,6 @@ final class PhabricatorPeopleProfilePanelEngine ->setBuiltinKey(self::PANEL_PROFILE) ->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); - // TODO: Convert this into a proper panel type. - $have_calendar = PhabricatorApplication::isClassInstalledForViewer( - 'PhabricatorCalendarApplication', - $viewer); - if ($have_calendar) { - $uri = urisprintf( - '/p/%s/calendar/', - $object->getUsername()); - - $panels[] = $this->newPanel() - ->setBuiltinKey('calendar') - ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) - ->setPanelProperty('icon', 'calendar') - ->setPanelProperty('name', pht('Calendar')) - ->setPanelProperty('uri', $uri); - } - $have_maniphest = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorManiphestApplication', $viewer);