From 953a449305bbd073207602f070b73bd917db86d5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 28 Mar 2019 16:21:24 -0700 Subject: [PATCH] Hide "Availability" and "Calendar" on user profiles for disabled users Summary: See downstream . That suggestion is a little light on details, but I basically agree that showing "Availability: Available" on disabled user profiles is kind of questionable/misleading. Just hide event information on disabled profiles, since this doesn't seem worth building a special "Availability: Who Knows, They Are Disabled, Good Luck" disabled state for. Test Plan: Looked at disabled and non-disabled user profiles, saw Calendar stuff only on the former. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20342 --- .../controller/PhabricatorPeopleProfileViewController.php | 6 ++++++ .../people/customfield/PhabricatorUserStatusField.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 0c32075932..6a4d68d6aa 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -175,6 +175,12 @@ final class PhabricatorPeopleProfileViewController return null; } + // Don't show calendar information for disabled users, since it's probably + // not useful or accurate and may be misleading. + if ($user->getIsDisabled()) { + return null; + } + $midnight = PhabricatorTime::getTodayMidnightDateTime($viewer); $week_end = clone $midnight; $week_end = $week_end->modify('+3 days'); diff --git a/src/applications/people/customfield/PhabricatorUserStatusField.php b/src/applications/people/customfield/PhabricatorUserStatusField.php index 2ae9158566..1716e8e198 100644 --- a/src/applications/people/customfield/PhabricatorUserStatusField.php +++ b/src/applications/people/customfield/PhabricatorUserStatusField.php @@ -30,6 +30,12 @@ final class PhabricatorUserStatusField $user = $this->getObject(); $viewer = $this->requireViewer(); + // Don't show availability for disabled users, since this is vaguely + // misleading to say "Availability: Available" and probably not useful. + if ($user->getIsDisabled()) { + return null; + } + return id(new PHUIUserAvailabilityView()) ->setViewer($viewer) ->setAvailableUser($user);