]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelistitem.php
Add direct link to parent notice
[quix0rs-gnu-social.git] / lib / noticelistitem.php
index f25613b9a96988972946b96b024cda003c735697..f38c7eb0ba8955585b7dfe677d8ecd7223df1d4a 100644 (file)
@@ -150,7 +150,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) || $this->addressees) {
+            $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');
     }
 
@@ -247,6 +253,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();
@@ -368,18 +387,19 @@ class NoticeListItem extends Widget
      */
     function showNoticeLocation()
     {
-        $id = $this->notice->id;
-
-        $location = $this->notice->getLocation();
-
-        if (empty($location)) {
+        return;
+        try {
+            $location = Notice_location::locFromStored($this->notice);
+        } catch (NoResultException $e) {
+            return;
+        } catch (ServerException $e) {
             return;
         }
 
         $name = $location->getName();
 
-        $lat = $this->notice->lat;
-        $lon = $this->notice->lon;
+        $lat = $location->lat;
+        $lon = $location->lon;
         $latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : '';
 
         if (empty($name)) {