]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/shownotice.php
Fix help text for getvaliddaemons.php
[quix0rs-gnu-social.git] / actions / shownotice.php
index 0d89af5acc40b81849ee4d4fb2b7ca80fdbe53fd..8f73dc824af6d6180fab885c571b7c265d8ebf0e 100644 (file)
@@ -45,7 +45,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  * @link     http://laconi.ca/
  */
 
-class ShownoticeAction extends Action
+class ShownoticeAction extends OwnerDesignAction
 {
     /**
      * Notice object to show
@@ -83,18 +83,25 @@ class ShownoticeAction extends Action
 
         $this->notice = Notice::staticGet($id);
 
-        if (!$this->notice) {
+        if (empty($this->notice)) {
             $this->clientError(_('No such notice.'), 404);
             return false;
         }
 
         $this->profile = $this->notice->getProfile();
 
-        if (!$this->profile) {
+        if (empty($this->profile)) {
             $this->serverError(_('Notice has no profile'), 500);
             return false;
         }
 
+        $this->user = User::staticGet('id', $this->profile->id);
+
+        if (empty($this->user)) {
+            $this->serverError(_('Not a local notice'), 500);
+            return false;
+        }
+
         $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
 
         return true;
@@ -158,8 +165,14 @@ class ShownoticeAction extends Action
 
     function title()
     {
+        if (!empty($this->profile->fullname)) {
+            $base = $this->profile->fullname . ' (' . $this->user->nickname . ') ';
+        } else {
+            $base = $this->user->nickname;
+        }
+
         return sprintf(_('%1$s\'s status on %2$s'),
-                       $this->profile->nickname,
+                       $base,
                        common_exact_date($this->notice->created));
     }
 
@@ -262,6 +275,20 @@ class ShownoticeAction extends Action
             $this->element('meta', array('name' => 'microid',
                                          'content' => $id->toString()));
         }
+        $this->element('link',array('rel'=>'alternate',
+            'type'=>'application/json+oembed',
+            'href'=>common_local_url(
+                'api',
+                array('apiaction'=>'oembed','method'=>'oembed.json'),
+                array('url'=>$this->notice->uri)),
+            'title'=>'oEmbed'),null);
+        $this->element('link',array('rel'=>'alternate',
+            'type'=>'text/xml+oembed',
+            'href'=>common_local_url(
+                'api',
+                array('apiaction'=>'oembed','method'=>'oembed.xml'),
+                array('url'=>$this->notice->uri)),
+            'title'=>'oEmbed'),null);
     }
 }