Only show parent wrapper if there are some

This commit is contained in:
Stephen Paul Weber 2015-10-23 18:51:33 +00:00
parent fc3f1f6942
commit cd22be3374

View File

@ -64,6 +64,7 @@ class NoticeListItem extends Widget
protected $options = true; protected $options = true;
protected $maxchars = 0; // if <= 0 it means use full posts protected $maxchars = 0; // if <= 0 it means use full posts
protected $item_tag = 'li'; protected $item_tag = 'li';
protected $pa = null;
/** /**
* constructor * constructor
@ -151,7 +152,7 @@ class NoticeListItem extends Widget
$this->showNoticeTitle(); $this->showNoticeTitle();
$this->showAuthor(); $this->showAuthor();
if (!empty($this->notice->reply_to) || $this->addressees) { if (!empty($this->notice->reply_to) || count($this->getProfileAddressees()) > 0) {
$this->elementStart('div', array('class' => 'parents')); $this->elementStart('div', array('class' => 'parents'));
if (!empty($this->notice->reply_to)) { $this->showParent(); } if (!empty($this->notice->reply_to)) { $this->showParent(); }
if ($this->addressees) { $this->showAddressees(); } if ($this->addressees) { $this->showAddressees(); }
@ -286,19 +287,20 @@ class NoticeListItem extends Widget
function getProfileAddressees() function getProfileAddressees()
{ {
$pa = array(); if($this->pa) { return $this->pa; }
$this->pa = array();
$attentions = $this->getReplyProfiles(); $attentions = $this->getReplyProfiles();
foreach ($attentions as $attn) { foreach ($attentions as $attn) {
$class = $attn->isGroup() ? 'group' : 'account'; $class = $attn->isGroup() ? 'group' : 'account';
$pa[] = array('href' => $attn->profileurl, $this->pa[] = array('href' => $attn->profileurl,
'title' => $attn->getNickname(), 'title' => $attn->getNickname(),
'class' => "addressee {$class}", 'class' => "addressee {$class}",
'text' => $attn->getStreamName()); 'text' => $attn->getStreamName());
} }
return $pa; return $this->pa;
} }
function getReplyProfiles() function getReplyProfiles()