]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelistitem.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / lib / noticelistitem.php
index 36668a8f77bf7685b45cd12b23cc36ee7e562f0b..88bb8bf92710429aad5f6f94d932bf9b404db8d3 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
@@ -150,7 +151,13 @@ class NoticeListItem extends Widget
         $this->elementStart('section', array('class'=>'notice-headers'));
         $this->showNoticeTitle();
         $this->showAuthor();
-        if ($this->addressees) { $this->showAddressees(); }
+
+        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(); }
+            $this->elementEnd('div');
+        }
         $this->elementEnd('section');
     }
 
@@ -237,8 +244,9 @@ class NoticeListItem extends Widget
     function showAuthor()
     {
         $attrs = array('href' => $this->profile->profileurl,
-                       'class' => 'h-card p-author',
+                       'class' => 'h-card',
                        'title' => $this->profile->getNickname());
+        if(empty($this->repeat)) { $attrs['class'] .= ' p-author'; }
 
         if (Event::handle('StartShowNoticeItemAuthor', array($this->profile, $this->out, &$attrs))) {
             $this->out->elementStart('a', $attrs);
@@ -249,6 +257,19 @@ class NoticeListItem extends Widget
         }
     }
 
+    function showParent()
+    {
+        $this->out->element(
+            'a',
+            array(
+                'href' => $this->notice->getParent()->getUrl(),
+                'class' => 'u-in-reply-to',
+                'rel' => 'in-reply-to'
+            ),
+            'in reply to'
+        );
+    }
+
     function showAddressees()
     {
         $pa = $this->getProfileAddressees();
@@ -269,19 +290,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()