]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Only show parent wrapper if there are some
authorStephen Paul Weber <singpolyma@singpolyma.net>
Fri, 23 Oct 2015 18:51:33 +0000 (18:51 +0000)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Fri, 23 Oct 2015 18:51:33 +0000 (18:51 +0000)
lib/noticelistitem.php

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