1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +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())
->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)

View file

@ -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);