From 354858e434067efb5d8d1dd1cc01f4a2a4b756c4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 31 Jan 2016 15:16:51 -0800 Subject: [PATCH] Disambiguate isEmpty() Summary: Fixes T10250. Rename the one I added to `hasAnyProperties()` for clarity. Test Plan: - Viewed a project profile with content. - Viewed a project profile with no properties. - Viewed a workboard with tasks that had a mixture of additional projects and no additional projects. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10250 Differential Revision: https://secure.phabricator.com/D15151 --- .../PhabricatorPeopleProfileViewController.php | 2 +- .../PhabricatorProjectProfileController.php | 2 +- .../project/view/ProjectBoardTaskCard.php | 11 +++++------ src/view/AphrontTagView.php | 4 ---- src/view/phui/PHUIPropertyListView.php | 6 +++--- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 1453ab7d71..cdbbddd8d8 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -112,7 +112,7 @@ final class PhabricatorPeopleProfileViewController PhabricatorCustomField::ROLE_VIEW); $field_list->appendFieldsToPropertyList($user, $viewer, $view); - if ($view->isEmpty()) { + if (!$view->hasAnyProperties()) { return null; } diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index c03b82b05d..74acd1edbf 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -125,7 +125,7 @@ final class PhabricatorProjectProfileController PhabricatorCustomField::ROLE_VIEW); $field_list->appendFieldsToPropertyList($project, $viewer, $view); - if ($view->isEmpty()) { + if (!$view->hasAnyProperties()) { return null; } diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php index 9ae3ef83c8..86f4359c08 100644 --- a/src/applications/project/view/ProjectBoardTaskCard.php +++ b/src/applications/project/view/ProjectBoardTaskCard.php @@ -86,12 +86,11 @@ final class ProjectBoardTaskCard extends Phobject { $project_phids = array_fuse($task->getProjectPHIDs()); unset($project_phids[$this->project->getPHID()]); - $handle_list = $viewer->loadHandles($project_phids); - $tag_list = id(new PHUIHandleTagListView()) - ->setSlim(true) - ->setHandles($handle_list); - - if (!$tag_list->isEmpty()) { + if ($project_phids) { + $handle_list = $viewer->loadHandles($project_phids); + $tag_list = id(new PHUIHandleTagListView()) + ->setSlim(true) + ->setHandles($handle_list); $card->addAttribute($tag_list); } diff --git a/src/view/AphrontTagView.php b/src/view/AphrontTagView.php index b82ebef9c3..a6eb722383 100644 --- a/src/view/AphrontTagView.php +++ b/src/view/AphrontTagView.php @@ -77,10 +77,6 @@ abstract class AphrontTagView extends AphrontView { return $this->id; } - public function isEmpty() { - return empty($this->getTagContent()); - } - protected function getTagName() { return 'div'; } diff --git a/src/view/phui/PHUIPropertyListView.php b/src/view/phui/PHUIPropertyListView.php index 0d60ed25b0..336c494a3c 100644 --- a/src/view/phui/PHUIPropertyListView.php +++ b/src/view/phui/PHUIPropertyListView.php @@ -115,14 +115,14 @@ final class PHUIPropertyListView extends AphrontView { $this->invokedWillRenderEvent = true; } - public function isEmpty() { + public function hasAnyProperties() { $this->invokeWillRenderEvent(); if ($this->parts) { - return false; + return true; } - return true; + return false; } public function render() {