]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelistitem.php
Merge remote-tracking branch 'upstream/master' into nightly
[quix0rs-gnu-social.git] / lib / noticelistitem.php
index ad5962d75123f9480b8436090f6db7fbee183021..a10169e36df3d0df9d0c6ebcb36431e5784c3748 100644 (file)
@@ -179,8 +179,9 @@ class NoticeListItem extends Widget
     function showNoticeTitle()
     {
         if (Event::handle('StartShowNoticeTitle', array($this))) {
+            $nameClass = $this->notice->getTitle(false) ? 'p-name ' : '';
             $this->element('a', array('href' => $this->notice->getUri(),
-                                      'class' => 'p-name u-uid'),
+                                      'class' => $nameClass . 'u-uid'),
                            $this->notice->getTitle());
             Event::handle('EndShowNoticeTitle', array($this));
         }
@@ -189,6 +190,7 @@ class NoticeListItem extends Widget
     function showNoticeInfo()
     {
         if (Event::handle('StartShowNoticeInfo', array($this))) {
+            $this->showContextLink();
             $this->showNoticeLink();
             $this->showNoticeSource();
             $this->showNoticeLocation();
@@ -301,9 +303,15 @@ class NoticeListItem extends Widget
 
         foreach ($attentions as $attn) {
             $class = $attn->isGroup() ? 'group' : 'account';
-            $this->pa[] = array('href' => $attn->profileurl,
+            $profileurl = $attn->getUri();
+            if (common_valid_http_url($profileurl)) {
+                $class .= ' u-uid';
+            } else {
+                $profileurl = $attn->getUrl();
+            }
+            $this->pa[] = array('href' => $profileurl,
                                 'title' => $attn->getNickname(),
-                                'class' => "addressee {$class}",
+                                'class' => "addressee {$class} p-name u-url",
                                 'text' => $attn->getStreamName());
         }
 
@@ -341,7 +349,8 @@ class NoticeListItem extends Widget
     function showContent()
     {
         // FIXME: URL, image, video, audio
-        $this->out->elementStart('article', array('class' => 'e-content'));
+        $nameClass = $this->notice->getTitle(false) ? '' : 'p-name ';
+        $this->out->elementStart('article', array('class' => $nameClass . 'e-content'));
         if (Event::handle('StartShowNoticeContent', array($this->notice, $this->out, $this->out->getScoped()))) {
             if ($this->maxchars > 0 && mb_strlen($this->notice->content) > $this->maxchars) {
                 $this->out->text(mb_substr($this->notice->content, 0, $this->maxchars) . '[…]');
@@ -369,14 +378,10 @@ class NoticeListItem extends Widget
      */
     function showNoticeLink()
     {
-        $this->out->elementStart('a', array('rel' => 'bookmark',
-                                            'class' => 'timestamp',
-                                            'href' => Conversation::getUrlFromNotice($this->notice)));
         $this->out->element('time', array('class' => 'dt-published',
                                           'datetime' => common_date_iso8601($this->notice->created),
                                           'title' => common_exact_date($this->notice->created)),
                             common_date_string($this->notice->created));
-        $this->out->elementEnd('a');
     }
 
     /**
@@ -390,7 +395,6 @@ class NoticeListItem extends Widget
      */
     function showNoticeLocation()
     {
-        return;
         try {
             $location = Notice_location::locFromStored($this->notice);
         } catch (NoResultException $e) {
@@ -562,6 +566,18 @@ class NoticeListItem extends Widget
         }
     }
 
+    /**
+     * Show link to conversation view.
+     */
+    function showContextLink()
+    {
+        $this->out->element('a', array('rel' => 'bookmark',
+                                            'class' => 'timestamp',
+                                            'href' => Conversation::getUrlFromNotice($this->notice)),
+                            // TRANS: A link to the conversation view of a notice, on the local server.
+                            _('In conversation'));
+    }
+
     /**
      * show a link to reply to the current notice
      *