1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Make it more clear that red dots next to usernames mean Calendar availability

Summary:
Ref T11809. We show a red dot next to a username to indicate that the user is away (on vacation, in a meeting, etc).

It's not very obvious what this means unless you know that's what it is: when you click the username or view a hovercard, there's no visual hint about what the red dot means. It does say "Away", but there is a lot of information and it doesn't visually connect the two.

Connect the two visually by putting a red dot next to the "Away" bit, too.

Test Plan:
Here's my version of it, this feels OK to me but could maybe be more designed:

{F1893916}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11809

Differential Revision: https://secure.phabricator.com/D16791
This commit is contained in:
epriestley 2016-11-02 10:02:51 -07:00
parent bf0004744b
commit c9510cc118
5 changed files with 56 additions and 21 deletions

View file

@ -1687,6 +1687,7 @@ phutil_register_library_map(array(
'PHUITimelineView' => 'view/phui/PHUITimelineView.php',
'PHUITwoColumnView' => 'view/phui/PHUITwoColumnView.php',
'PHUITypeaheadExample' => 'applications/uiexample/examples/PHUITypeaheadExample.php',
'PHUIUserAvailabilityView' => 'applications/calendar/view/PHUIUserAvailabilityView.php',
'PHUIWorkboardView' => 'view/phui/PHUIWorkboardView.php',
'PHUIWorkpanelView' => 'view/phui/PHUIWorkpanelView.php',
'PassphraseAbstractKey' => 'applications/passphrase/keys/PassphraseAbstractKey.php',
@ -6461,6 +6462,7 @@ phutil_register_library_map(array(
'PHUITimelineView' => 'AphrontView',
'PHUITwoColumnView' => 'AphrontTagView',
'PHUITypeaheadExample' => 'PhabricatorUIExample',
'PHUIUserAvailabilityView' => 'AphrontTagView',
'PHUIWorkboardView' => 'AphrontTagView',
'PHUIWorkpanelView' => 'AphrontTagView',
'PassphraseAbstractKey' => 'Phobject',

View file

@ -0,0 +1,44 @@
<?php
final class PHUIUserAvailabilityView
extends AphrontTagView {
private $user;
public function setAvailableUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function getAvailableUser() {
return $this->user;
}
protected function getTagContent() {
$viewer = $this->getViewer();
$user = $this->getAvailableUser();
$until = $user->getAwayUntil();
if (!$until) {
return pht('Available');
}
$away_tag = id(new PHUITagView())
->setType(PHUITagView::TYPE_SHADE)
->setShade(PHUITagView::COLOR_RED)
->setName(pht('Away'))
->setDotColor(PHUITagView::COLOR_RED);
$now = PhabricatorTime::getNow();
$description = pht(
'Away until %s',
$viewer->formatShortDateTime($until, $now));
return array(
$away_tag,
' ',
$description,
);
}
}

View file

@ -10,7 +10,7 @@ final class PhabricatorUserStatusField
}
public function getFieldName() {
return pht('Status');
return pht('Availability');
}
public function getFieldDescription() {
@ -29,7 +29,10 @@ final class PhabricatorUserStatusField
public function renderPropertyViewValue(array $handles) {
$user = $this->getObject();
$viewer = $this->requireViewer();
return $user->getAvailabilityDescription($viewer);
return id(new PHUIUserAvailabilityView())
->setViewer($viewer)
->setAvailableUser($user);
}
}

View file

@ -960,23 +960,6 @@ final class PhabricatorUser
}
/**
* Describe the user's availability.
*
* @param PhabricatorUser Viewing user.
* @return string Human-readable description of away status.
* @task availability
*/
public function getAvailabilityDescription(PhabricatorUser $viewer) {
$until = $this->getAwayUntil();
if ($until) {
return pht('Away until %s', phabricator_datetime($until, $viewer));
} else {
return pht('Available');
}
}
/**
* Get cached availability, if present.
*

View file

@ -75,8 +75,11 @@ final class PhabricatorUserCardView extends AphrontTagView {
if (PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorCalendarApplication',
$viewer)) {
$availability = $user->getAvailabilityDescription($viewer);
$body[] = $this->addItem(pht('Status'), $availability);
$body[] = $this->addItem(
pht('Availability'),
id(new PHUIUserAvailabilityView())
->setViewer($viewer)
->setAvailableUser($user));
}
$badges = $this->buildBadges($user, $viewer);