1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

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
This commit is contained in:
lkassianik 2016-05-23 11:17:27 -07:00
parent 359e8d4aa5
commit 627b95bf78
2 changed files with 16 additions and 30 deletions

View file

@ -192,7 +192,7 @@ final class PhabricatorPeopleProfileViewController
$query = id(new PhabricatorCalendarEventQuery()) $query = id(new PhabricatorCalendarEventQuery())
->setViewer($viewer) ->setViewer($viewer)
->withDateRange($range_start, $range_end) ->withDateRange($range_start, $range_end)
->withInvitedPHIDs(array($viewer->getPHID())) ->withInvitedPHIDs(array($user->getPHID()))
->withIsCancelled(false); ->withIsCancelled(false);
$statuses = $query->execute(); $statuses = $query->execute();
@ -200,23 +200,22 @@ final class PhabricatorPeopleProfileViewController
$events = array(); $events = array();
foreach ($statuses as $status) { foreach ($statuses as $status) {
$viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); $viewer_is_invited = $status->getIsUserInvited($user->getPHID());
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$status, $status,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$event = new AphrontCalendarEventView(); $event = id(new AphrontCalendarEventView())
$event->setCanEdit($can_edit); ->setCanEdit($can_edit)
$event->setEventID($status->getID()); ->setEventID($status->getID())
$event->setEpochRange($status->getDateFrom(), $status->getDateTo()); ->setEpochRange($status->getDateFrom(), $status->getDateTo())
$event->setIsAllDay($status->getIsAllDay()); ->setIsAllDay($status->getIsAllDay())
$event->setIcon($status->getIcon()); ->setIcon($status->getIcon())
$event->setViewerIsInvited($viewer_is_invited); ->setViewerIsInvited($viewer_is_invited)
->setName($status->getName())
$event->setName($status->getName()); ->setURI($status->getURI());
$event->setURI($status->getURI());
$events[] = $event; $events[] = $event;
} }
@ -229,7 +228,11 @@ final class PhabricatorPeopleProfileViewController
->render(); ->render();
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader(pht('Calendar')); ->setHeader(pht('Calendar'))
->setHref(
urisprintf(
'/calendar/?invitedPHIDs=%s#R',
$user->getPHID()));
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($header)
->appendChild($day_view) ->appendChild($day_view)

View file

@ -26,23 +26,6 @@ final class PhabricatorPeopleProfilePanelEngine
->setBuiltinKey(self::PANEL_PROFILE) ->setBuiltinKey(self::PANEL_PROFILE)
->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); ->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( $have_maniphest = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorManiphestApplication', 'PhabricatorManiphestApplication',
$viewer); $viewer);