]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
Merge branch 'testing' into 0.9.x
[quix0rs-gnu-social.git] / lib / noticelist.php
index dcf17be08c5423ab253a021f6fb48999beda5d95..0d4cd4dd91c7d87ab68a89065be58121b1f345fc 100644 (file)
@@ -380,12 +380,12 @@ class NoticeListItem extends Widget
 
     function showNoticeLink()
     {
-        if($this->notice->is_local == Notice::LOCAL_PUBLIC || $this->notice->is_local == Notice::LOCAL_NONPUBLIC){
-            $noticeurl = common_local_url('shownotice',
-                                      array('notice' => $this->notice->id));
-        }else{
-            $noticeurl = $this->notice->uri;
-        }
+        $noticeurl = $this->notice->bestUrl();
+
+        // above should always return an URL
+
+        assert(!empty($noticeurl));
+
         $this->out->elementStart('a', array('rel' => 'bookmark',
                                             'class' => 'timestamp',
                                             'href' => $noticeurl));
@@ -442,11 +442,14 @@ class NoticeListItem extends Widget
                                               'title' => $latlon),
                                 $name);
         } else {
-            $this->out->elementStart('a', array('href' => $url));
-            $this->out->element('abbr', array('class' => 'geo',
-                                              'title' => $latlon),
-                                $name);
-            $this->out->elementEnd('a');
+            $xstr = new XMLStringer(false);
+            $xstr->elementStart('a', array('href' => $url,
+                                           'rel' => 'external'));
+            $xstr->element('abbr', array('class' => 'geo',
+                                         'title' => $latlon),
+                           $name);
+            $xstr->elementEnd('a');
+            $this->out->raw($xstr->getString());
         }
         $this->out->elementEnd('span');
     }
@@ -540,22 +543,40 @@ class NoticeListItem extends Widget
     function showContext()
     {
         $hasConversation = false;
-        if( !empty($this->notice->conversation)
-            && $this->notice->conversation != $this->notice->id){
-            $hasConversation = true;
-        }else{
-            $conversation = Notice::conversationStream($this->notice->id, 1, 1);
-            if($conversation->N > 0){
+        if (!empty($this->notice->conversation)) {
+            $conversation = Notice::conversationStream(
+                $this->notice->conversation,
+                1,
+                1
+            );
+            if ($conversation->N > 0) {
                 $hasConversation = true;
             }
         }
-        if ($hasConversation){
-            $this->out->text(' ');
-            $convurl = common_local_url('conversation',
-                                         array('id' => $this->notice->conversation));
-            $this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id,
-                                           'class' => 'response'),
-                                _('in context'));
+        if ($hasConversation) {
+            $conv = Conversation::staticGet(
+                'id',
+                $this->notice->conversation
+            );
+            $convurl = $conv->uri;
+            if (!empty($convurl)) {
+                $this->out->text(' ');
+                $this->out->element(
+                    'a',
+                    array(
+                    'href' => $convurl.'#notice-'.$this->notice->id,
+                    'class' => 'response'),
+                    _('in context')
+                );
+            } else {
+                $msg = sprintf(
+                    "Couldn't find Conversation ID %d to make 'in context'"
+                    . "link for Notice ID %d",
+                    $this->notice->conversation,
+                    $this->notice->id
+                );
+                common_log(LOG_WARNING, $msg);
+            }
         }
     }