1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

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
This commit is contained in:
epriestley 2016-01-31 15:16:51 -08:00
parent 080d838c69
commit 354858e434
5 changed files with 10 additions and 15 deletions

View file

@ -112,7 +112,7 @@ final class PhabricatorPeopleProfileViewController
PhabricatorCustomField::ROLE_VIEW); PhabricatorCustomField::ROLE_VIEW);
$field_list->appendFieldsToPropertyList($user, $viewer, $view); $field_list->appendFieldsToPropertyList($user, $viewer, $view);
if ($view->isEmpty()) { if (!$view->hasAnyProperties()) {
return null; return null;
} }

View file

@ -125,7 +125,7 @@ final class PhabricatorProjectProfileController
PhabricatorCustomField::ROLE_VIEW); PhabricatorCustomField::ROLE_VIEW);
$field_list->appendFieldsToPropertyList($project, $viewer, $view); $field_list->appendFieldsToPropertyList($project, $viewer, $view);
if ($view->isEmpty()) { if (!$view->hasAnyProperties()) {
return null; return null;
} }

View file

@ -86,12 +86,11 @@ final class ProjectBoardTaskCard extends Phobject {
$project_phids = array_fuse($task->getProjectPHIDs()); $project_phids = array_fuse($task->getProjectPHIDs());
unset($project_phids[$this->project->getPHID()]); unset($project_phids[$this->project->getPHID()]);
$handle_list = $viewer->loadHandles($project_phids); if ($project_phids) {
$tag_list = id(new PHUIHandleTagListView()) $handle_list = $viewer->loadHandles($project_phids);
->setSlim(true) $tag_list = id(new PHUIHandleTagListView())
->setHandles($handle_list); ->setSlim(true)
->setHandles($handle_list);
if (!$tag_list->isEmpty()) {
$card->addAttribute($tag_list); $card->addAttribute($tag_list);
} }

View file

@ -77,10 +77,6 @@ abstract class AphrontTagView extends AphrontView {
return $this->id; return $this->id;
} }
public function isEmpty() {
return empty($this->getTagContent());
}
protected function getTagName() { protected function getTagName() {
return 'div'; return 'div';
} }

View file

@ -115,14 +115,14 @@ final class PHUIPropertyListView extends AphrontView {
$this->invokedWillRenderEvent = true; $this->invokedWillRenderEvent = true;
} }
public function isEmpty() { public function hasAnyProperties() {
$this->invokeWillRenderEvent(); $this->invokeWillRenderEvent();
if ($this->parts) { if ($this->parts) {
return false; return true;
} }
return true; return false;
} }
public function render() { public function render() {