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:
		| @@ -1687,6 +1687,7 @@ phutil_register_library_map(array( | |||||||
|     'PHUITimelineView' => 'view/phui/PHUITimelineView.php', |     'PHUITimelineView' => 'view/phui/PHUITimelineView.php', | ||||||
|     'PHUITwoColumnView' => 'view/phui/PHUITwoColumnView.php', |     'PHUITwoColumnView' => 'view/phui/PHUITwoColumnView.php', | ||||||
|     'PHUITypeaheadExample' => 'applications/uiexample/examples/PHUITypeaheadExample.php', |     'PHUITypeaheadExample' => 'applications/uiexample/examples/PHUITypeaheadExample.php', | ||||||
|  |     'PHUIUserAvailabilityView' => 'applications/calendar/view/PHUIUserAvailabilityView.php', | ||||||
|     'PHUIWorkboardView' => 'view/phui/PHUIWorkboardView.php', |     'PHUIWorkboardView' => 'view/phui/PHUIWorkboardView.php', | ||||||
|     'PHUIWorkpanelView' => 'view/phui/PHUIWorkpanelView.php', |     'PHUIWorkpanelView' => 'view/phui/PHUIWorkpanelView.php', | ||||||
|     'PassphraseAbstractKey' => 'applications/passphrase/keys/PassphraseAbstractKey.php', |     'PassphraseAbstractKey' => 'applications/passphrase/keys/PassphraseAbstractKey.php', | ||||||
| @@ -6461,6 +6462,7 @@ phutil_register_library_map(array( | |||||||
|     'PHUITimelineView' => 'AphrontView', |     'PHUITimelineView' => 'AphrontView', | ||||||
|     'PHUITwoColumnView' => 'AphrontTagView', |     'PHUITwoColumnView' => 'AphrontTagView', | ||||||
|     'PHUITypeaheadExample' => 'PhabricatorUIExample', |     'PHUITypeaheadExample' => 'PhabricatorUIExample', | ||||||
|  |     'PHUIUserAvailabilityView' => 'AphrontTagView', | ||||||
|     'PHUIWorkboardView' => 'AphrontTagView', |     'PHUIWorkboardView' => 'AphrontTagView', | ||||||
|     'PHUIWorkpanelView' => 'AphrontTagView', |     'PHUIWorkpanelView' => 'AphrontTagView', | ||||||
|     'PassphraseAbstractKey' => 'Phobject', |     'PassphraseAbstractKey' => 'Phobject', | ||||||
|   | |||||||
							
								
								
									
										44
									
								
								src/applications/calendar/view/PHUIUserAvailabilityView.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/applications/calendar/view/PHUIUserAvailabilityView.php
									
									
									
									
									
										Normal 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, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -10,7 +10,7 @@ final class PhabricatorUserStatusField | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   public function getFieldName() { |   public function getFieldName() { | ||||||
|     return pht('Status'); |     return pht('Availability'); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   public function getFieldDescription() { |   public function getFieldDescription() { | ||||||
| @@ -29,7 +29,10 @@ final class PhabricatorUserStatusField | |||||||
|   public function renderPropertyViewValue(array $handles) { |   public function renderPropertyViewValue(array $handles) { | ||||||
|     $user = $this->getObject(); |     $user = $this->getObject(); | ||||||
|     $viewer = $this->requireViewer(); |     $viewer = $this->requireViewer(); | ||||||
|     return $user->getAvailabilityDescription($viewer); |  | ||||||
|  |     return id(new PHUIUserAvailabilityView()) | ||||||
|  |       ->setViewer($viewer) | ||||||
|  |       ->setAvailableUser($user); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -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. |    * Get cached availability, if present. | ||||||
|    * |    * | ||||||
|   | |||||||
| @@ -75,8 +75,11 @@ final class PhabricatorUserCardView extends AphrontTagView { | |||||||
|     if (PhabricatorApplication::isClassInstalledForViewer( |     if (PhabricatorApplication::isClassInstalledForViewer( | ||||||
|         'PhabricatorCalendarApplication', |         'PhabricatorCalendarApplication', | ||||||
|         $viewer)) { |         $viewer)) { | ||||||
|       $availability = $user->getAvailabilityDescription($viewer); |       $body[] = $this->addItem( | ||||||
|       $body[] = $this->addItem(pht('Status'), $availability); |         pht('Availability'), | ||||||
|  |         id(new PHUIUserAvailabilityView()) | ||||||
|  |           ->setViewer($viewer) | ||||||
|  |           ->setAvailableUser($user)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $badges = $this->buildBadges($user, $viewer); |     $badges = $this->buildBadges($user, $viewer); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley